Skip to main content

Crate ainl_graph_extractor

Crate ainl_graph_extractor 

Source
Expand description

Graph extractor task: bump semantic recurrence_count from retrieval deltas, then run persona evolution.

Alpha: API may change before 1.0.

Persona evolution rows use ainl_persona::EVOLUTION_TRAIT_NAME — import that constant from ainl-persona when matching evolution bundles; do not duplicate the string.

Note: GraphExtractorTask::evolution_engine is the canonical in-process handle to ainl_persona::EvolutionEngine. ainl-runtime exposes the same engine for direct ingest_signals / correction_tick / evolve calls; this crate’s run_pass is one signal path, not the only one.

§run_pass and ExtractionReport

GraphExtractorTask::run_pass returns an ExtractionReport (not Result<_, _>): semantic / pattern / persona phases record errors in extract_error, pattern_error, and persona_error respectively. Use ExtractionReport::has_errors before treating a pass as clean. ArmaraOS GraphMemoryWriter::run_persona_evolution_pass surfaces the same struct and logs warnings for populated error slots.

Structs§

ExtractPassCollected
Collected signals plus episode tag writes deferred to flush_episode_pattern_tags.
ExtractionReport
Result of GraphExtractorTask::run_pass. Errors are carried per phase; the pass does not return Result so callers can record partial progress and continue.
GraphExtractorTask
PersonaSignalExtractorState
Rolling state for debounce / streak detectors (in-memory, per GraphExtractorTask).
SemanticTag
TurnVitals
Minimal vitals snapshot accepted by this crate (avoids a direct openfang-types dep).

Enums§

TagNamespace

Constants§

AXIS_EVOLUTION_SNAPSHOT
Stable alias for the same trait string (documentation / import ergonomics).
EVOLUTION_TRAIT_NAME
Canonical ainl_memory::PersonaNode::trait_name for axis-evolution bundles. graph_extractor (Prompt 2) should import this from the crate root when selecting persona rows for domain / formality signals — do not duplicate the string.

Functions§

extract_pass
Episode-ordered heuristics plus semantic domain pass; updates state and may patch episode rows.
extract_pass_collect
Build signals and pending episode tag patches without writing episodes yet.
extract_turn_semantic_tags_for_memory
Semantic tags from one completed turn suitable for downstream fact extraction.
flush_episode_pattern_tags
Apply episode persona_signals_emitted tag patches from extract_pass_collect.
run_extraction_pass
Convenience wrapper for one-off extraction. Creates a fresh GraphExtractorTask with a new crate::PersonaSignalExtractorState on each call, so streak-based detectors (brevity, formality) cannot fire across invocations. For long-running agent loops, instantiate GraphExtractorTask directly and call GraphExtractorTask::run_pass to preserve streak state between passes.
tag_tool_names
Maps tool name strings to canonical TagNamespace::Tool tags. Unknown tools are retained with a sanitized slug and confidence 0.5.
update_semantic_recurrence
For each semantic node for agent_id, if reference_count increased since the last extractor snapshot, increment recurrence_count by at most 1 and refresh _last_ref_snapshot.