Entity schema exposure: entity_schema / entity_types / entity_type_filter, so an entity's type and relations are one call instead of filtering triples by hand #291
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/wi-019fce4d-entity-schema-exposure-entity-schema-ent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Anima work item
019fce4d-302b-7a01-8d64-163638ed7d0f.Part 2 of 2, split from
019e480e-44e8-7213-b072-bdfacd98af68(which is cancelled).Part 1 is the Goal CRUD handlers — a separate work item. They share nothing but the
MCP/control-plane registration surface. Do not do Part 1 here.
⚠ Read this first: two traps that have already cost 10 sessions
1. The old work item's auto-generated triage plan pointed at the WRONG REPOSITORY. It
listed
proto/anima/v1/agent.proto,crates/anima-core/…,crates/anima-db/…,crates/anima-server/…,crates/anima-agent/…. Those are Anima paths. This isakh-medu, a separate repo with its own crates, and
anima-agent/anima-aiare retiredin Anima anyway (ADR 0018). That mis-generation is a plausible cause of the repeated
failures. Ignore it; work from the real akhomed surface in this repo.
2. If you hit the same wall twice, STOP and report it rather than burning turns. The
predecessor looped through 9 failed sessions before being parked.
The problem
Entity type information is buried in triples. To learn what an entity is, a caller has to
triples_ofand filter foris-aby hand. There is no notion of an entity schema at thetool level.
What to build
Three tools:
entity_schema {entity, workspace}— the entity's type hierarchy, its outgoing andincoming relation types, confidence scores, and a provenance summary.
entity_types {workspace}— every distinct entity type (the values ofis-arelations) with counts.
entity_type_filter {workspace, type, page, page_size}— all entities of a giventype with their core attributes. Paginate it — a common type will match a great many
entities.
Target shape for
entity_schema entity=Tecton:Open questions to resolve while implementing
episodes_referencingcheaply available? The original description assumed it. Ifepisode tracking cannot answer it without new infrastructure, drop that field and say so
rather than building tracking to satisfy an example payload.
workspace, or whether it needs caching. Measure on a populated workspace before adding a
cache — an unnecessary cache is its own bug.
is-aat all should be represented explicitly(empty
types), not omitted — detecting incomplete identity is one of the stated uses.Acceptance
(
triples_of,kg_mutate,kg_delete) are registered — check all registration sites,since tools here are registered in more than one place.
entity_schemaon a well-connected entity returns both directions of relations.entity_typescounts match a manual count of distinctis-aobjects.entity_type_filterpaginates correctly at a page boundary.Verify before you trust the description
Written 2026-05-21. Check the live tool surface first — what exists today may already cover
part of this.
Review verdict: BLOCK — the tools are dead code. The code quality inside
entity_schema.rsis good (correctTooltrait usage, graceful unknown-entity handling, 9 solid unit tests), but nothing connects it to the crate:Blocker 1 — module never declared:
src/agent/tools/mod.rshas nopub mod entity_schema;, so the file is not compiled into the crate at all. CI is green because the code is invisible to the compiler.Blocker 2 — tools never registered: Compare with
KgQueryTool, which is registered in 4 places:src/agent/tools/mod.rs,src/agent/agent.rs:316,src/agent/tool_semantics.rs:438,src/agent/vsa_decide.rs:577.EntitySchemaTool/EntityTypesTool/EntityTypeFilterToolappear in none of them — no agent, ACP surface, or MCP exposure can reach them.Blocker 3 — goal not delivered: the WI's acceptance ("an entity's type and relations are one call instead of filtering triples by hand") requires a caller to be able to make that call. Currently none can.
Required fix: add
pub mod entity_schema;+pub use entity_schema::{EntitySchemaTool, EntityTypesTool, EntityTypeFilterTool};tomod.rs, and register all three at every registry construction site (agent.rs,tool_semantics.rs,vsa_decide.rs, plus the manifest/tool-exposure lists). Then verify with a test that resolves the tools by name throughToolRegistry.Minor 4 —
entity_schema.rs:47: localconst IS_A: &str = "is-a"duplicatesPRED_IS_Ainsrc/schema/compile.rs:25; reuse the existing constant to avoid drift.Minor 5 —
entity_schema.rs:351:page.max(0)on ausizeis a no-op; drop it.63a6df26621699571fd1WIP: Entity schema exposure: entity_schema / entity_types / entity_type_filter, so an entity's type and relations are one call instead of filtering triples by handto Entity schema exposure: entity_schema / entity_types / entity_type_filter, so an entity's type and relations are one call instead of filtering triples by hand