§7 Metrics/Analyzer — implementation work blocked on 5 BMAD design questions #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
§7 (Metrics/Analyzer) is the load-bearing prerequisite for §2 (trust threshold) and §3 (dynamic scope-overlap policy) per
docs/multi-project-orchestration-plan_amendments.md. §2 and §3 cannot land without it. This issue captures the implementation work and the 5 open design questions that BMAD needs to answer before code lands.Source of truth
/opt/damascus/llm-wiki/concepts/§7-metrics-analyzer.md(status: draft; the canonical input/output/side-effects contract).docs/multi-project-orchestration-plan_amendments.md§7 (rolling rates: first-pass merge rate @ 85%/70%, rebase-conflict rate @ 5%/10%).schema.sql, no migration needed):work_items(phase, attempts, last_verdict, updated_at, merged_at, project, story_id, file_scope)events_outbox(kind, work_item_id, payload, created_at)— every transition logged bystate.emit_event()cost_ledger(work_item_id, project, phase, input_tokens, output_tokens, usd, recorded_at)— optional consumer for §1 SRVG, not required for §2/§3.Required output (v1 surface)
first_pass_merge_rateattempts=1phase='merged'rebase_conflict_raterebase_conflictphase='merged'p95_attempts_to_mergeBold rows are the required v1 surface.
p95_attempts_to_mergeis cheap to compute alongside and called out for completeness.Open design questions (need BMAD/human input)
These are listed in full in the contract page §6. The implementation is silent on these on purpose. Each option has tradeoffs; the heartbeat cannot pick.
metrics_windowstable with one row per(metric_name, as_of)for queryable history vs. rely onevents_outbox(metric.*)as the only audit trail (cheaper, harder to backfill).events_outboxtransition log but the contract doesn't say which log event is the canonical "first attempt" marker.first_pass_merge_ratemean when fewer than 50 items have merged? §2 needs to be safe when N < 50. Reasonable default: rate is undefined and the threshold check is skipped until N >= 50.Minimum bar to call §7 "done"
Per the contract page §"What the implementation must include":
metricsmodule undersrc/damascus/exposing the two required rolling rates and the threshold-crossing event emitter.damascus metricsCLI verb returning the current snapshot for the operator.tests/contract/test_metrics.pyE2E suite that:skills/SKILL.mddocumenting the new CLI verb and the threshold-crossing event type.Items 1–3 are the load-bearing work. Item 4 is operator hygiene.
Why this is not in the current PR queue
Related
/opt/damascus/llm-wiki/concepts/§7-metrics-analyzer.mddocs/multi-project-orchestration-plan_amendments.md/opt/damascus/llm-wiki/concepts/amendment-sequencing.mddocs/multi-project-orchestration-plan_1.md§7Heartbeat status (no human currently assigned)
Filed by the 30-min heartbeat agent in YOLO mode (Kay is away). This issue is descriptive — no implementation decision has been made. The first human (or BMAD run) to pick this up should resolve the 5 open questions before code lands.
Heartbeat recommendations (added 2026-06-23 by the 30-min heartbeat, YOLO mode)
Per the gap-finding discipline ("don't punt 'BMAD picks' without a recommendation"), the heartbeat adds the following as proposals for BMAD/human to accept or override. These are NOT implementation choices in code; they live only in the issue body for the design call.
Q1 (Cadence) — Recommend: both (on-merge + on-demand CLI).
phase='merged', rare relative to build/review churn.events_outboxis append-only by design.Q2 (Storage) — Recommend: rely on
events_outbox(metric.*)only.metrics_windowstable is a second source of truth that has to stay in sync with the events log.events_outboxis already the audit trail; reading the last 50/100 metric events is one indexed query againstevents_outbox(work_item_id, kind, created_at).Q3 (Window scope for §3) — Recommend: per-project primary, fallback to global when project history < window size.
rebase_conflict_rate's window-size (100) merged items, use the global rate for that project's policy decision.Q4 (First-pass vs. any-pass marker) — Recommend:
work_items.attempts == 1at the merge event is the canonical first-pass marker.attemptscolumn is the existing source of truth; it increments on each retry per the cycle inphases.py.events_outboxfor the first row per work_item withpayload->>'target' = 'merged'; checkwork_items.attempts == 1at that moment.phase.transitionper work item"): noisier — includes spec→build, build→review, etc., not just merge attempts. Stick withattempts == 1 at merge.Q5 (Empty windows) — Recommend: rate is undefined until N >= window_size; CLI surfaces
n/total.n >= window_size(50 for first-pass, 100 for rebase-conflict) before acting on the rate.n/totalso the operator sees partial state explicitly (e.g.first_pass_merge_rate = undefined (n=23/50)).How to action these
BMAD picks from the 5 recommendations above. If any is rejected, BMAD writes the alternative into the contract page (
/opt/damascus/llm-wiki/concepts/§7-metrics-analyzer.md§6) and this issue gets updated to point to the new contract text. Code PR for the metrics module is then a mechanical translation of the contract — not a design decision.If all 5 are accepted as-is, the heartbeat will write the contract page updates on the next tick (descriptive work, gap-finding discipline compliant: editing the contract text IS the descriptive work, not choosing implementation). Then a separate PR can land the actual
metrics.pymodule.§7 contract page landed (heartbeat, 2026-06-24)
Per the issue body's last paragraph, I wrote the §7 contract page at
wiki/concepts/§7-metrics-analyzer.mdwith my 5 recommendations mirrored as "Heartbeat-proposed answers (pending BMAD/human approval)."Page is on
kaykayyali/damascus-wikimain (commite475104, pushed). It documents:events_outbox+work_items, no schema migration)first_pass_merge_rateover 50,rebase_conflict_rateover 100,p95_attempts_to_merge) +metric.threshold_crossedevent shapedamascus metricsCLI + contract tests + SKILL.md update)No code change, no PR. The contract is now in the place the implementation will translate from — BMAD/human accepts/overrides in §6/§7, then the implementation PR is a mechanical translation, not a design call.
One unit of progress this tick: the contract page exists. Next tick: pick up PR #7 (
fix(compose): db service self-heals tainted dbdata volume on bootstrap) which is 14 commits behind current main and needs a rebase (likely via thegit merge mainrecipe from the skill, conflict zone is one contract-test file at most).— damascus-heartbeat