Skip to content

fix(prompts): name every type in suggest_entities, not just the JVM ones - #79

Open
johnsonr wants to merge 2 commits into
mainfrom
fix/suggest-entities-template
Open

fix(prompts): name every type in suggest_entities, not just the JVM ones#79
johnsonr wants to merge 2 commits into
mainfrom
fix/suggest-entities-template

Conversation

@johnsonr

@johnsonr johnsonr commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

The bug

suggest_entities.jinja rendered the list of permitted types with domainType.clazz.simpleName. clazz exists only on JvmType — a DynamicType has name/ownLabel and no clazz.

So every schema-declared type (in a configured world, most of them) rendered as an empty name directly under:

Entity types must only come from the following list:

    - : A calendar event surfaced as a signal — typically an upcoming meeting…
    - : An email thread surfaced when something in it warrants attention…

The model is then told "You must be sure that every entity is of one of the types above" and "Use the most specific domain type possible" against a list that names nothing. Jinjava logged one warning per type per chunk — 396 in one appliance's log:

WARN JinjavaTemplateRenderer : Template warning: Line 9: [clazz] Cannot resolve property 'clazz'
in 'DynamicType(name=calendar.meeting, description=A calendar event surfaced as a signal…'

A second, separate defect in the same file: context.directions (198 more warnings). SourceAnalysisContext has no directions — its fields are schema, entityResolver, contextId, knownEntities, relations, promptVariables, sourceLocator, perspective, mintNewEntities, mintedEntityProperties. It is a vestige of the field SourceAnalysisConfig carried in the predecessor project; the conditional has been permanently false, so that instruction never reached a prompt. (KnowledgeGraphBuilder's KDoc still promises the context holds "schema and directions for analysis".)

Together these were every template warning in that log.

The change

  • domainType.clazz.simpleNamedomainType.ownLabel, and the parents chain map(attribute='clazz') | map(attribute='simpleName')map(attribute='ownLabel').

    ownLabel is the correct key in both directions: for a JvmType it is the simple name, so JVM types render byte-for-byte as before; and it is what extracted labels are matched against on the write side — DrivineNamedEntityDataRepository.save matches entity.labels() against dataDictionary.jvmTypes.map { it.ownLabel }.

  • context.directionsdirections. promptVariables are spread at the top level of the template model (LlmEntityExtractor: mapOf("context" to context, "chunk" to chunk) + context.promptVariables), so this renders whatever a caller supplied via withPromptVariables and stays silent otherwise — turning dead markup into a working extension point. Deleting the block outright is the alternative if you'd rather not keep it.

Tests

New SuggestEntitiesTemplateTest renders the template through JinjavaTemplateRenderer against a DynamicType schema and asserts the label, description and properties all appear, plus that directions render when supplied and are absent when not.

Verified it bites: reverted to the old template → both tests fail; restored → both pass. Existing PropositionExtractionTemplateTest (24 tests) still green.

Note

embabel-object-graph carries a copy of this template with the same clazz defect (plus propose_facts.jinja) — fixed there separately. Its directions reference is correct, because its SourceAnalysisConfig really does have that field; that is where this one was inherited from.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CdQPAxBM1m7CG645DKeMYa

johnsonr and others added 2 commits August 3, 2026 13:51
…hitecture

Maps KnowledgeType onto CoALA's memory taxonomy, catalogues the mechanism
decisions CoALA leaves open that DICE answers, and states scope honestly
(decision loop, working-memory management, executable skills are the agent
framework's job).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DWLCsrVSJHggsSMf6XJZHC
The template read `domainType.clazz.simpleName`, and `clazz` exists only on
JvmType. Every DynamicType — the schema-declared types, which are most of them
in a configured world — rendered with an EMPTY name under "Entity types must
only come from the following list". A prompt that names none of its types
cannot be obeyed, and Jinjava logged one "Cannot resolve property 'clazz'" per
type per chunk: 396 warnings in one appliance's log.

`ownLabel` is the right key. For a JvmType it IS the simple name, so those
render exactly as before; it is also what extracted labels are matched back
against (DrivineNamedEntityDataRepository.save matches entity.labels() against
jvmTypes.map { it.ownLabel }).

The same template's `context.directions` was a vestige of a field that no
longer exists on SourceAnalysisContext — the block never rendered, and logged
198 more warnings. promptVariables are spread at the top level of the template
model, so plain `directions` makes the extension point real: it renders what a
caller supplies and stays silent when none did.

The new test renders the template with a DynamicType schema and fails on the
old one, in both respects.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CdQPAxBM1m7CG645DKeMYa
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.

1 participant