fix(stats): M6 — trekbrief and trekplan records land where the yardstick reads
New lib/stats/stats-append.mjs: one record on stdin, appended to
<data dir>/<kind>-stats.jsonl. The data dir is CLAUDE_PLUGIN_DATA, else
~/.claude/plugins/data/voyage-ktg-plugin-marketplace (the yardstick's
default). A failed write exits 1 with a reason: reported, never silent.
/trekbrief Phase 7 and /trekplan Phase 12 now run it instead of
"append to ${CLAUDE_PLUGIN_DATA}/…; skip silently". intent-approval's
resolveApprovalDataDir delegates to the same resolver.
Chose a stdin heredoc over a --json argument because a JSON record in a
shell argument breaks on quotes in task text. Only trekbrief and trekplan
are rewired (økt 2's countable form needs exactly those two); the other
commands' stats prose is unchanged and docs/architecture.md says so.
Red a358059 7/7 → green 7/7. Suite 1208: 1206 pass / 0 fail / 2 skip.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a358059997
commit
d906999036
5 changed files with 105 additions and 18 deletions
|
|
@ -840,17 +840,19 @@ multi-session waves.
|
|||
|
||||
## Phase 12 — Session tracking
|
||||
|
||||
After the plan is presented (Phase 10) or after handoff (Phase 11), write a
|
||||
session record to `${CLAUDE_PLUGIN_DATA}/trekplan-stats.jsonl` (create the file
|
||||
if it does not exist).
|
||||
After the plan is presented (Phase 10) or after handoff (Phase 11), append a
|
||||
session record to `trekplan-stats.jsonl` in the plugin data directory. Run it
|
||||
exactly like this. The record goes on stdin, and the writer resolves the
|
||||
directory: `CLAUDE_PLUGIN_DATA`, which the Bash tool env does not carry, else
|
||||
the directory `scripts/yardstick.mjs` reads.
|
||||
|
||||
Record format (one JSON line):
|
||||
```json
|
||||
```bash
|
||||
node ${CLAUDE_PLUGIN_ROOT}/lib/stats/stats-append.mjs trekplan <<'JSON'
|
||||
{
|
||||
"ts": "{ISO-8601 timestamp}",
|
||||
"task": "{task description (first 100 chars)}",
|
||||
"mode": "{default|fg|quick}",
|
||||
"slug": "{plan slug}",
|
||||
"slug": "{the brief's slug}",
|
||||
"brief_path": "{brief_path}",
|
||||
"project_dir": "{project_dir or null}",
|
||||
"codebase_size": "{small|medium|large}",
|
||||
|
|
@ -863,10 +865,14 @@ Record format (one JSON line):
|
|||
"guardian_verdict": "{ALIGNED|CREEP|GAP|MIXED}",
|
||||
"outcome": "{execute|execute_team|save|refine}"
|
||||
}
|
||||
JSON
|
||||
```
|
||||
|
||||
If `${CLAUDE_PLUGIN_DATA}` is not set or not writable, skip tracking silently.
|
||||
Never let tracking failures block the main workflow.
|
||||
`slug` is the brief's `slug`, so this record pairs with the brief's
|
||||
`brief-approved` and `trekbrief` records. The writer prints
|
||||
`{"written": true, ...}`. On `"written": false` (exit 1), print its `reason` in
|
||||
one line and continue. A tracking failure never blocks the main workflow, but
|
||||
it is reported, not skipped silently.
|
||||
|
||||
## Profile (v4.1)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue