fleet-memory/hindsight-cli/src/commands
Nicolò Boschi ea662d062e
feat: fact_types and mental model exclusion filters for reflect (#615)
* feat: add fact_types and mental model exclusion filters to reflect and mental models

Adds three new filtering options to both the reflect endpoint and mental model creation/refresh:

- `fact_types`: restrict which fact types (world, experience, observation) are retrieved.
  Disables irrelevant agent tools entirely (no wasted tokens).
- `exclude_mental_models`: skip the search_mental_models tool altogether.
- `exclude_mental_model_ids`: exclude specific mental models by ID (merged with the
  existing self-exclusion logic during mental model refresh).

For mental models, options are persisted in the existing `trigger` JSONB column so they
are automatically applied on every refresh. The `UpdateMentalModelRequest` already
proxies `trigger`, so no extra endpoint changes are needed.

Also fixes the test fixture (`pg0_db_url` in conftest.py) to correctly resolve pg0://
URLs and run migrations before tests, which was causing all DB-dependent tests to fail
with "relation public.banks does not exist" when HINDSIGHT_API_DATABASE_URL=pg0://uuuu.

* fix: guard against disabled-tool hallucination and regenerate clients

- Add enabled_tools guard in reflect agent: if an LLM calls a tool that
  was excluded (e.g. recall when fact_types=["observation"]), return an
  error result instead of executing it
- Regenerate OpenAPI spec and all SDK clients (Go, Python, TypeScript)
  to include new fact_types / exclude_mental_models fields

* fix: add missing ReflectRequest fields in Rust CLI struct initializers

* fix: filter hallucinated tool calls before trace to prevent disabled tools appearing in results

* chore: merge main, fix lint formatting and update skills openapi.json

* feat: expose fact_types, exclude_mental_models, exclude_mental_model_ids in control plane UI

* fix: add missing trigger fields to MentalModel type in control plane api.ts

* fix: add missing trigger fields to local MentalModel interface in mental-models-view

* feat: tabbed mental model dialogs (Basic / Options tabs)

* refactor: shared FactTypeFilter component, tabbed mental model dialogs use General tab, clean up labels

* feat: pill-style toggle buttons for fact type filter (blue/emerald/amber per type)

* fix: add spacing between Fact Types label and pills, rename to Exclude all mental models
2026-03-19 17:03:41 +01:00
..
bank.rs feat: 4-tab code parity across all documentation examples (#613) 2026-03-19 11:31:51 +01:00
chunk.rs feat(clients): mental models api (#172) 2026-01-19 14:49:49 +01:00
directive.rs feat: 4-tab code parity across all documentation examples (#613) 2026-03-19 11:31:51 +01:00
document.rs feat(cli): add --wait flag for consolidate and --date filter for document list (#244) 2026-01-30 09:04:35 +01:00
entity.rs fix: entities list only show 100 entities (#142) 2026-01-12 18:50:53 +01:00
explore.rs feat: fact_types and mental model exclusion filters for reflect (#615) 2026-03-19 17:03:41 +01:00
health.rs fix: misc fixes for observations and mental models (#209) 2026-01-27 15:37:57 +01:00
memory.rs feat: fact_types and mental model exclusion filters for reflect (#615) 2026-03-19 17:03:41 +01:00
mental_model.rs feat: 4-tab code parity across all documentation examples (#613) 2026-03-19 11:31:51 +01:00
mod.rs chore: internal renames (#204) 2026-01-27 09:53:28 +01:00
operation.rs feat(clients): mental models api (#172) 2026-01-19 14:49:49 +01:00
tag.rs feat(clients): mental models api (#172) 2026-01-19 14:49:49 +01:00