Skip to content

Catalog facts for agent memory - #330

Merged
bradhe merged 5 commits into
developfrom
features/catalog-facts
Jul 27, 2026
Merged

Catalog facts for agent memory#330
bradhe merged 5 commits into
developfrom
features/catalog-facts

Conversation

@bradhe

@bradhe bradhe commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

This PR integrates catalog facts from the API into the CLI to give agents memory about data stored in a catalog. This is just an experimental feature to see how it improves (or not) workloads.

Example

╰─$ cargo run -- catalogs facts set soft-delete --statement "deleted_at means that an element was soft deleted" --scope column --object bronze.runs.deleted_at --confidence confirmed --source human
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.46s
     Running `target/debug/tower catalogs facts set soft-delete --statement 'deleted_at means that an element was soft deleted' --scope column --object bronze.runs.deleted_at --confidence confirmed --source human`
error: the following required arguments were not provided:
  <fact_name>

Usage: tower catalogs facts set --statement <statement> --scope <scope> --object <object> --confidence <confidence> --source <source> <catalog_name> <fact_name>

For more information, try '--help'.
$ cargo run -- catalogs facts set default runs-soft-delete --statement "deleted_at means that an element was soft deleted" --scope column --object bronze.runs.deleted_at --confidence confirmed --source human 
✔ Saving fact... Done!
Success! Fact 'runs-soft-delete' saved in catalog 'default'
$ cargo run -- catalogs facts list default
✔ Listing facts... Done!
 Name              Scope   Object                  Confidence  Statement                                         
-----------------------------------------------------------------------------------------------------------------
 runs-soft-delete  column  bronze.runs.deleted_at  confirmed   deleted_at means that an element was soft deleted 

error: unexpected argument '-f' found

  tip: to pass '-f' as a value, use '-- -f'

Usage: tower catalogs facts list [OPTIONS] <catalog_name>

For more information, try '--help'.
$ cargo run -- catalogs facts list default -j
[
  {
    "confidence": "confirmed",
    "created_at": "2026-07-22T15:08:32.817697Z",
    "name": "runs-soft-delete",
    "object": "bronze.runs.deleted_at",
    "scope": "column",
    "source": "human",
    "statement": "deleted_at means that an element was soft deleted",
    "updated_at": "2026-07-22T15:08:32.817697Z"
  }
]

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 982bee0e-58b7-42a1-8c32-4cc36f83071f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch features/catalog-facts

Comment @coderabbitai help to get the list of available commands.

@bradhe
bradhe changed the base branch from develop to features/add-full-overview-to-catalogs-show July 22, 2026 15:11
@bradhe bradhe changed the title Features/catalog facts Catalog facts for agent memory Jul 22, 2026
Comment thread crates/tower-cmd/src/catalogs.rs Outdated
.help("Environment the catalog belongs to")
.action(ArgAction::Set);

Command::new("facts")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

facts has a specific meaning when it comes to data analytics so I would presume this command name is confusing to both humans(like me :D) and ai. Perhaps a better name is meta or ai-context

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah maybe we want to disambiguate this from fact tables in a data warehousing context. I'll take a quick look at this.

Base automatically changed from features/add-full-overview-to-catalogs-show to develop July 23, 2026 09:56
bradhe added 2 commits July 23, 2026 16:27
`facts` collides with fact tables in dimensional modeling — confusing
right where this lives, on a data catalog. Rename the CLI surface and
tower-cmd internals to `knowledge`. The generated tower-api client still
calls them `facts` since the backend is unchanged.
Resolves the conflict in catalogs.rs, which was entirely in that one file.

Two things had landed on develop since this branch was cut. #329 added the
`--full` overview to `catalogs show`, which this branch also carries its own copy
of, and #331 moved the DuckDB plumbing out into the tower-duckdb crate. The
overlap on `--full` is what made the conflict large: the same feature existed on
both sides.

Resolved by taking develop's catalogs.rs and re-applying only what is unique to
this branch, the `knowledge` command and its helpers, rather than hand-merging
hunks of duplicated work. So the `--full` implementation is develop's, which is
the version that was reviewed and merged and has since been through the
tower-duckdb refactor; `run_duckdb_query` and `duckdb_value_to_json` are gone
from this file because they now live in tower-duckdb, and their tests moved with
them; and `knowledge` is unchanged from this branch, with all eleven of its tests
restored.

Verified: 112 tests pass (develop's 101 plus this branch's 11), `catalogs
knowledge` and `catalogs query --max-rows` both work in the built binary, and
catalogs.rs has no clippy warnings.
@bradhe
bradhe merged commit 2fe2b3a into develop Jul 27, 2026
28 checks passed
@bradhe
bradhe deleted the features/catalog-facts branch July 27, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants