Veikart steg 1, økt 1 av 2. The three holes measured in the grounds: (1) ## Intent / ## Goal were only checked for existence, (2) no approval marker existed, (3) brief-approved was emitted only on the auto path. - lib/validators/intent-approval.mjs: --check / --stamp. The marker is intent_approved_hash (sha256 over normalized ## Intent + ## Goal) + intent_approved_at. Editing either section after approval → STALE. - /trekplan Phase 1 (Read the brief, both --brief and --project): runs --check and HALTS on BRIEF_INTENT_NOT_APPROVED / _STALE / _INVALID with the remedy spelled out; an unrunnable check halts too. - /trekbrief Phase 4h (before the Phase 5 fork, asked even in --quick): shows Intent + Goal verbatim, AskUserQuestion Approve / Revise / Leave; only "Approve" runs --stamp. --stamp emits brief-approved, so the manual (default) path records it; the auto path's own emission is removed. New mode /trekbrief --approve <project-dir> = Phase 4h alone. - README, CLAUDE.md, command-modes, HANDOVER-CONTRACTS §Handover 1, jsonl-schemas (trekbrief-stats gains intent_approved). Valgt ingen brief_version-bump fordi skjemaendringen er rent additiv (to valgfrie felt) og kravet sitter i /trekplan — enhver produsents brief kan godkjennes via /trekbrief --approve uten produsentendring. Valgt eget --check-kall i stedet for et flagg på brief-validator fordi --brief-stien i dag ikke kjører validatoren i det hele tatt; et nytt validatorkall der ville også stoppe på andre feil. Valgt fallback-datamappe = målestokkens (plugins/data/voyage-…) fordi CLAUDE_PLUGIN_DATA er tom i Bash-miljøet og event-emits egen fallback er stille skip — slik ble brief-approved 0 records. What the marker does NOT prove (module header, command prose, contract): same user, same machine — any session can stamp. A trace, not a signature. Suite 1183 → 1201 (1199/0/2). Mutants M1–M5 (stale check off, check always valid, gate line removed, stamp emits nothing, no normalization) each fell ≥ 1 test. yardstick unchanged: RED, 1 of 3 countable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6.1 KiB
Voyage JSONL stats — schema audit (v4.1 input)
Purpose: Field-allowlist input for v4.1 OTel exporter (Step 11). Lists every field every voyage stats JSONL writer emits today, plus the additive fields v4.1 introduces. Load-bearing for Step 11 (field-allowlist) and Step 8 (stats plumbing).
PII-flag:
command_excerptfromhooks/scripts/post-bash-stats.mjsslices the first 120 chars of an arbitrary Bash command — may contain operator paths, branch names, or fragments of secrets that survived the secrets-hook. CWE-212 (Improper Cross-boundary Removal of Sensitive Data). The OTel exporter MUST NOT export this field unless the operator explicitly opts in viaVOYAGE_EXPORT_INCLUDE_COMMAND_EXCERPT=1(deferred to v4.2 — v4.1 hard-excludes).Additive v4.1 fields:
profile,phase_models,parallel_agents,external_research_enabled,profile_source. All are forward-compat: existing v4.0 consumers ignore unknown keys, v4.1 consumers get richer signal.
Field table per JSONL writer
| schema_id | fields | writer_path | line_ref | v4.1 additive | PII |
|---|---|---|---|---|---|
| trekbrief-stats | ts, task, slug, mode, interview_turns, review_iterations, brief_quality, research_topics, auto_research, auto_result, intent_approved, project_dir | commands/trekbrief.md (orchestrator-emit Phase 7) | trekbrief.md:657-672 | profile, phase_models, profile_source | none |
| trekresearch-stats | ts, question, mode, scope, engine, slug, project_dir, brief_path, dimensions, dimensions_baseline, dimensions_baseline_preserved, effort, conv_turns, empty_turns, unique_sources, agents_local, agents_external, gemini_used, confidence, contradictions, open_questions | commands/trekresearch.md (orchestrator-emit Stats tracking) | trekresearch.md:634-676 | profile, phase_models, parallel_agents, external_research_enabled, profile_source | none |
| trekplan-stats | ts, task, mode, slug, brief_path, project_dir, codebase_size, codebase_files, agents_deployed, deep_dives, research_briefs_used, research_scout_used, critic_verdict, guardian_verdict, outcome | commands/trekplan.md (orchestrator-emit Phase 12) | trekplan.md:805-826 | profile, phase_models, parallel_agents, profile_source | none |
| trekexecute-stats (Phase 9 record) | ts, plan, plan_type, mode, result, steps_total, steps_passed, steps_failed, steps_skipped, failed_at_step | commands/trekexecute.md (orchestrator-emit Phase 9) | trekexecute.md:1479-1494 | profile, phase_models, profile_source | none |
| trekexecute-stats (autonomy events) | ts, event, known_event, payload | lib/stats/event-emit.mjs emit() |
event-emit.mjs:64-86 | payload.profile, payload.phase_models, payload.profile_source | none |
| trekexecute-stats (PostToolUse Bash) | ts, session_id, command_excerpt, duration_ms, success | hooks/scripts/post-bash-stats.mjs (Bash PostToolUse) | post-bash-stats.mjs:42-54 | none (hook is plugin-level, not profile-aware) | command_excerpt (CWE-212) |
| trekreview-stats | ts, slug, verdict, counts (BLOCKER/MAJOR/MINOR/SUGGESTION), reviewed_files_count, mode, duration_ms | commands/trekreview.md (orchestrator-emit Phase 8) | trekreview.md:255 | profile, phase_models, profile_source | none |
| trekcontinue-stats | ts, project, next_session_label, status | commands/trekcontinue.md (orchestrator-emit Phase 5) | trekcontinue.md:289 | profile, profile_source | none |
| token-usage | ts, session_id, scope, model, tokens_input, tokens_output, tokens_cache_creation, tokens_cache_read, cost_usd, is_estimate, price_table_version | lib/stats/token-usage.mjs captureTokenUsage (via hooks/scripts/otel-export.mjs Stop hook, opt-in VOYAGE_TOKEN_METER) |
token-usage.mjs:buildRecord | n/a (SKAL-2 schema) | session_id (stripped at export) |
Field-allowlist input for Step 11
The OTel exporter (Step 11 lib/exporters/field-allowlist.mjs) MUST inline the
following static const arrays (NOT load from this file at runtime — Step 11
explicit constraint: INLINE static const, IKKE runtime fra tests/fixtures):
EXPORT_ALLOWLIST (numeric/bool/short-string fields safe for OTel metric labels):
ts, slug, mode, brief_quality, auto_research, auto_result,
codebase_size, codebase_files, agents_deployed, deep_dives,
agents_local, agents_external, gemini_used, dimensions, confidence,
contradictions, open_questions, interview_turns, review_iterations,
research_topics, research_briefs_used, research_scout_used,
critic_verdict, guardian_verdict, outcome, plan_type, result,
steps_total, steps_passed, steps_failed, steps_skipped, failed_at_step,
verdict, reviewed_files_count, duration_ms, status, next_session_label,
event, known_event, success, scope,
profile, profile_source, parallel_agents, external_research_enabled,
model, tokens_input, tokens_output, tokens_cache_creation, tokens_cache_read,
cost_usd, is_estimate, price_table_version
EXPORT_DENYLIST (PII or high-cardinality, never export):
task, question, project_dir, project, plan, brief_path, command_excerpt, payload, counts, phase_models, session_id
Notes:
taskandquestionmay contain user-content prose → high-cardinality + PII risk.project_dirand paths leak filesystem layout.command_excerptper CWE-212 above.phase_modelsis a structured object (6 keys) — too high-cardinality for label; profile name (profile) is the safe summary. v4.2 may revisit if operators ask.counts(review BLOCKER/MAJOR/MINOR/SUGGESTION) is a nested object — Step 11 exporter flattens tovoyage_review_counts_blocker/_major/_minor/_suggestionmetrics rather than a label.session_idis a UUID — high-cardinality, not useful as a label, log-only.
Cross-reference
- Step 8 (stats plumbing) — adds
profile+phase_models+profile_sourceto all 6 orchestrator-emit sites listed above. - Step 11 (field-allowlist) — codifies the EXPORT_ALLOWLIST/DENYLIST arrays above
as inline static consts in
lib/exporters/field-allowlist.mjs. - Step 9 (Prometheus textfile) — emits one metric line per allowlist-numeric field per JSONL writer; PII-flagged fields are dropped at format-layer, not export-layer.