feat: Фаза 7 шаги 4-6 — session-review skill + postrun-report + quality-gate

Step 4: skills/agent-session-review/SKILL.md (dual-write root+chezmoi)
  - 4 mandatory blocks: brief_md / agent_trace / self_reflection / most_important
  - Karpathy method: synthesize on write, mandatory before deliver gate

Step 5: chezmoi/dot_agents/registry/scripts/athena-postrun-report.mjs
  - Adapted from mnemazine-postrun-knowledge-report.mjs (520→~120 lines)
  - Input: --results-json [{group_id, outcome, helps, next_action}]
  - Output: --format md (default) | html | json
  - Env: ATHENA_REPORTS, ATHENA_RUN_ID; zero hardcoded paths

Step 6: chezmoi/dot_agents/registry/scripts/athena-report-quality-gate.mjs
  - Adapted from mnemazine-report-quality-gate.mjs (99→~110 lines)
  - 5 rules: no-raw-ocr / no-local-paths / no-secrets / has-outcome / has-next-action
  - Accepts .html and .md reports; exit 0=pass, 1=fail

Smoke: agent-contract.sh +4 checks (SKILL.md blocks, postrun synthetic,
  gate positive PASS, gate negative FAIL). smoke green, shellcheck -S error 0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Зарубин Филипп
2026-06-23 18:33:42 +03:00
co-authored by Claude Sonnet 4.6
parent 3094b0a6ae
commit cc947028c5
5 changed files with 536 additions and 1 deletions
+101
View File
@@ -0,0 +1,101 @@
---
name: agent-session-review
description: Local session learning tail — capture brief_md / agent_trace / self_reflection / most_important at the final edge of a job. Mandatory gate before deliver. Triggers: "session tail", "job done", "end of run", "learning tail", /agent-session-review.
metadata:
model: Sonnet
---
# Agent Session Review (learning tail)
The final edge of every job. A job is not done with a text answer — it is done when the tail is written.
Karpathy method: synthesize on write, not store raw. Short, precise, survives context compression.
Runs at the end of every meaningful agent session **before** handoff / deliver gate.
Mandated by the `final-learning-tail` gate in `handoff-graph.yaml`.
---
## Trigger
- After completing a multi-step job (any provider: Claude Code, Codex).
- Before writing to vault, before handoff, before the deliver gate fires.
- Gate edge `final-learning-tail` checks all four blocks are present.
---
## Four required blocks
All four **must** be present. Missing any block → gate fails.
---
### brief_md
3–5 bullets. What was actually done — artifacts produced, decisions made.
Describe what changed, not what was asked.
```
## Session Brief
- [artifact]: [one concrete line]
- [decision]: [one concrete line]
```
---
### agent_trace
Chronology of key tool calls and decision points.
Not every tool — only inflection points where direction was chosen or changed.
```
## Agent Trace
1. [tool / action] → [outcome or decision]
2. ...
```
---
### self_reflection
One short paragraph each.
```
## Self-Reflection
**Went well:** ...
**Went wrong / could be better:** ...
**Next time:** ...
```
---
### most_important
Single most important thing not to lose: a constraint, a lesson, a warning, a pattern.
Must fit in **one sentence** — this is what survives context compression.
```
## Most Important
[one sentence]
```
---
## Output
Write the tail to `~/.agents/reports/<run-id>-session-tail.md`
or append to the job outbox note.
Optionally pass to the postrun report:
```bash
node ~/.agents/registry/scripts/athena-postrun-report.mjs \
--results-json <results.json> \
--run-id <run-id>
```
---
## Gate check (smoke/agent-contract.sh)
Smoke verifies this file exists and contains all four block names:
`brief_md`, `agent_trace`, `self_reflection`, `most_important`.