generated from coulomb/repo-seed
Implement AGENTIC-WP-0011 kaizen correlation follow-up
Add bidirectional doc links (PRD §9.1, README, DESIGN §11), session-close HELIX_* env convention, stable digest JSON contract, and digest_lookup CLI for read-only correlate lookups. All tasks done; 163 tests green.
This commit is contained in:
@@ -394,10 +394,65 @@ into Helix Forge.
|
||||
**Related kaizen-agentic docs:** [ADR-004 project metrics convention](https://gitea.coulomb.social/coulomb/kaizen-agentic/src/branch/main/docs/adr/ADR-004-project-metrics-convention.md),
|
||||
[wiki/EcosystemIntegration.md](https://gitea.coulomb.social/coulomb/kaizen-agentic/src/branch/main/wiki/EcosystemIntegration.md).
|
||||
|
||||
### 11.1 Session-close env export (dual-layer agents)
|
||||
|
||||
Agents that run **both** Helix Forge capture and kaizen `metrics record` should
|
||||
export the following **after** the ingest sweep has written the session digest
|
||||
(`python -m session_memory.ingest` or an equivalent Stop/SessionEnd hook). Names
|
||||
match kaizen-agentic ADR-004 — do not invent parallel aliases.
|
||||
|
||||
| Variable | Source in Helix Forge | Purpose |
|
||||
|----------|----------------------|---------|
|
||||
| `HELIX_SESSION_UID` | `Session.session_uid` | Primary correlation key → `helix_session_uid` |
|
||||
| `HELIX_REPO` | `digest.repo` | Project/repo scoping |
|
||||
| `HELIX_FLAVOR` | `digest.flavor` | Agent runtime (`claude` / `codex` / `grok`) |
|
||||
| `HELIX_TOKENS` | `digest.cost.input_tokens + digest.cost.output_tokens` | Token rollup → `tokens` |
|
||||
| `HELIX_INFRA_OVERHEAD_SHARE` | infra bucket share over `tool_histogram` (see `measure.metrics.session_metrics`) | MCP/plumbing overhead → `infra_overhead_share` |
|
||||
|
||||
Example (after digest exists):
|
||||
|
||||
```bash
|
||||
export HELIX_SESSION_UID="claude:abc-123"
|
||||
export HELIX_REPO="agentic-resources"
|
||||
export HELIX_FLAVOR="claude"
|
||||
export HELIX_TOKENS=125000
|
||||
export HELIX_INFRA_OVERHEAD_SHARE=0.117
|
||||
# optional — lets kaizen correlate without guessing the store location:
|
||||
export HELIX_STORE_DB="$(pwd)/session_memory/.store/mem.db"
|
||||
kaizen-agentic metrics record # merges HELIX_* when present
|
||||
```
|
||||
|
||||
### 11.2 Digest store location and read API
|
||||
|
||||
- **`HELIX_STORE_DB`** — absolute path to the SQLite file holding Tier 2 digests.
|
||||
Defaults to `config.toml` `[store].db_path` (`session_memory/.store/mem.db` relative
|
||||
to the repo root). Export as an absolute path when setting the variable on session
|
||||
close so `metrics correlate` works across hosts and working directories.
|
||||
- **Thin CLI** — `python -m session_memory.digest_lookup <session_uid> [--json]`
|
||||
prints one digest without running ingest. Exit `0` on hit, `1` when missing.
|
||||
- **Programmatic** — `Store.get_digest(session_uid)` returns the JSON blob written
|
||||
by `build_digest` / `analyze`.
|
||||
|
||||
**Stable digest JSON shape** (fields consumers may rely on):
|
||||
|
||||
| Field | Type | Notes |
|
||||
|-------|------|-------|
|
||||
| `session_uid` | string | Normalized uid (`<flavor>:<native-id>`) |
|
||||
| `flavor`, `repo`, `domain` | string | Session attribution |
|
||||
| `model` | string | Model id when known |
|
||||
| `started_at`, `ended_at` | string | ISO timestamps |
|
||||
| `outcome` | string | `success` / `fail` / `abandoned` / `unknown` |
|
||||
| `cost` | object | `input_tokens`, `output_tokens`, `cache_tokens`, `wall_clock_s`, `turns`, `retries` |
|
||||
| `tool_histogram` | object | Tool name → call count |
|
||||
| `event_count`, `kind_counts`, `markers` | object/int | Compact activity summary |
|
||||
| `first_prompt`, `last_assistant` | string | Short text snippets |
|
||||
| `error_snippets` | array | `{fingerprint, sample, count, tool}` entries |
|
||||
| `schema_version` | int | Digest schema version |
|
||||
|
||||
---
|
||||
|
||||
*Next step: [AGENTIC-WP-0002] implements Phase 0 — the schema, the Claude
|
||||
collector, the Tier1/Tier2 store, and the budget-based eviction sweep.*
|
||||
*Implemented:* Phases 0–4, weekly retro ([AGENTIC-WP-0002]–[AGENTIC-WP-0010]);
|
||||
kaizen correlation follow-up ([AGENTIC-WP-0011]).
|
||||
|
||||
## Sources
|
||||
|
||||
|
||||
Reference in New Issue
Block a user