Skip to content

feat(orchestrator): ExitClassifier with KG-boosted agent exit classification#758

Merged
AlexMikhalev merged 3 commits intomainfrom
task/395-agent-run-record-exit-class
Apr 5, 2026
Merged

feat(orchestrator): ExitClassifier with KG-boosted agent exit classification#758
AlexMikhalev merged 3 commits intomainfrom
task/395-agent-run-record-exit-class

Conversation

@AlexMikhalev
Copy link
Copy Markdown
Contributor

Summary

  • Add ExitClassifier with KG-boosted Aho-Corasick pattern matching on agent stderr/stdout for structured exit classification
  • Add AgentRunRecord with classified ExitClass (12 variants), matched patterns, and confidence score
  • Integrate classification into poll_agent_exits() reconciliation loop with Quickwit LogDocument.extra injection
  • Leverage terraphim-markdown-parser AST-based heading extraction for MarkdownDirectives (replaces naive line scanning)
  • Add extract_first_heading() to terraphim-markdown-parser using markdown::to_mdast
  • Use heading (not file stem) as display name in builder.rs:concept_from_path()

Test plan

  • 18 unit tests for ExitClassifier covering all 12 exit classes, serialisation, truncation, in-memory store
  • 4 unit tests for AST-based heading extraction (inline code, missing heading, H2 skip)
  • 4 unit tests for heading integration in markdown_directives (extract_heading_from_path, heading in directives)
  • cargo clippy -- -D warnings clean
  • cargo test --workspace passes

Refs #395 (Gitea)

Generated with Terraphim AI

Terraphim CI and others added 2 commits April 5, 2026 23:36
…ation

Implement structured agent exit classification using terraphim-automata
Aho-Corasick pattern matching on stderr/stdout. Each agent exit now
produces an AgentRunRecord with classified ExitClass, matched patterns,
and confidence score.

- Add ExitClass enum (12 variants) and ExitClassifier in agent_run_record.rs
- Build exit class thesaurus programmatically from KG patterns
- Integrate classification into poll_agent_exits() reconciliation loop
- Inject exit_class into Quickwit LogDocument.extra for observability
- Add heading extraction to MarkdownDirectives (replaces raw file read)
- Use markdown_directives::extract_heading_from_path in builder.rs
- Add exit class KG thesaurus at docs/src/kg/exit_classes.md
- 18 unit tests for classifier, 4 tests for heading extraction

Refs #395

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…traction

Replace naive line-based heading extraction with AST-based parsing from
terraphim-markdown-parser. The parser handles inline code, emphasis, and
other markdown within headings correctly.

- Include terraphim-markdown-parser in workspace (was excluded)
- Add extract_first_heading() to terraphim-markdown-parser using AST
- Wire markdown_directives to use AST parser for heading extraction
- Add 4 tests for heading extraction in markdown parser crate

Refs #395

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

Documentation Preview

Your documentation changes have been deployed to:
https://9ef3a0f3.terraphim-docs.pages.dev

This preview will be available until the PR is closed.

- cargo fmt: reformat 4 files for edition 2024 style (wiki_sync, store,
  symbolic_embedding_bench, gitea)
- clippy: gate load_restart_counts with #[cfg(not(test))] to match its
  only call site (was dead code in test builds)
- wasm: replace workspace = true with explicit versions in standalone
  wasm-test/Cargo.toml (standalone workspace cannot inherit)

Refs #395

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

Documentation Preview

Your documentation changes have been deployed to:
https://4ed8b7a9.terraphim-docs.pages.dev

This preview will be available until the PR is closed.

@AlexMikhalev AlexMikhalev merged commit 0e9a5a6 into main Apr 5, 2026
31 of 35 checks passed
@AlexMikhalev AlexMikhalev deleted the task/395-agent-run-record-exit-class branch April 5, 2026 23:21
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