Updated tech specs for:

- Tool candidates on Analysis events
- Token counts — per-event on provenance, aggregated on service
  responses, --show-usage on all CLIs
- Termination reason on terminal events
- Tool error/retry events with Error mixin
- Sub-agent linkage (was already correct)
- Vocabulary publication (OWL ontology)
- Step counter on iteration events
- Pattern decision entity in DAG
- Latency breakdown (LLM + tool duration)
- Envelope field naming unified (message_type)
- LLM parse errors handled gracefully
This commit is contained in:
Cyber MacGeddon 2026-04-13 17:26:08 +01:00
parent d2751553a3
commit 245d705171
7 changed files with 205 additions and 233 deletions

View file

@ -138,6 +138,25 @@ Defined in `trustgraph-base/trustgraph/provenance/namespaces.py`:
| `TG_REASONING` | `https://trustgraph.ai/ns/reasoning` |
| `TG_CONTENT` | `https://trustgraph.ai/ns/content` |
| `TG_DOCUMENT` | `https://trustgraph.ai/ns/document` |
| `TG_IN_TOKEN` | `https://trustgraph.ai/ns/inToken` |
| `TG_OUT_TOKEN` | `https://trustgraph.ai/ns/outToken` |
| `TG_LLM_MODEL` | `https://trustgraph.ai/ns/llmModel` |
### Token Usage on Events
Grounding, Focus, and Synthesis events carry per-event LLM token counts:
| Predicate | Type | Present on |
|-----------|------|------------|
| `tg:inToken` | integer | Grounding, Focus, Synthesis |
| `tg:outToken` | integer | Grounding, Focus, Synthesis |
| `tg:llmModel` | string | Grounding, Focus, Synthesis |
- **Grounding**: tokens from the extract-concepts LLM call
- **Focus**: summed tokens from edge-scoring + edge-reasoning LLM calls
- **Synthesis**: tokens from the synthesis LLM call
Values are absent (not zero) when token counts are unavailable.
## GraphRagResponse Schema
@ -261,8 +280,13 @@ Based on the provided knowledge statements...
| `trustgraph-flow/trustgraph/query/triples/cassandra/service.py` | Quoted triple query support |
| `trustgraph-cli/trustgraph/cli/invoke_graph_rag.py` | CLI with explainability display |
## Vocabulary Reference
The full OWL ontology covering all classes and predicates is at `specs/ontology/trustgraph.ttl`.
## References
- PROV-O (W3C Provenance Ontology): https://www.w3.org/TR/prov-o/
- RDF-star: https://w3c.github.io/rdf-star/
- Extraction-time provenance: `docs/tech-specs/extraction-time-provenance.md`
- Agent explainability: `docs/tech-specs/agent-explainability.md`