⚠️ SUPERSEDED (2026-07-04; banner added 2026-07-06). Part A’s decisions D1–D7 were re-resolved as LB1/LB2 + CD-1…CD-10 in
concept-analysis-v2.md; Part B’s phased plan was replaced by the 75-WPdevelopment-plan.mdas amended bybest-path-decision.md§6. Its phase numbering is the OLD scheme (see finding PROC-6). Keep for the audit trail; do not act on it. Current entry point:PROJECT-STATE-2026-07-06.md.
Companion to
concept-analysis.md. Part A re-runs the four-lens review in decision form — every open question resolved into a recommendation with a rationale. Part B turns those decisions into a sequenced, testable, coverage-gated build plan that honours the project’s non-negotiable security invariants (docs/ai/DESIGN.md§8) and Ivan’s delivery bar (>90% coverage · README badges + donation · GitHub Pages docs site).Status (as written, 2026-07-04): plan only — no code scaffolded. The stack/structure decisions below are recommendations to approve, consistent with DESIGN §10 leaning.
Status correction (2026-08-15): the code has since been scaffolded and built, and the delivery bar quoted above shipped at 100% coverage rather than >90%. This document is still superseded and still must not be acted on; the correction is here only so that a reader who arrives at this page first does not carry away a picture of the repository that stopped being true on 2026-07-11.
The concept review surfaced seven open questions. Here each is resolved. These resolutions are the plan’s premises; changing one changes the plan.
Decision. Treat ~/.claude/projects/*.jsonl as the primary, durable source of
truth; tail-follow it and replay-on-startup. Use hooks only for sub-second
liveness (instant “agent started/stopped” signals) and for events JSONL doesn’t
carry. Every write is an idempotent upsert keyed on a stable event id, so hooks
and JSONL converging on the same fact never double-count.
Why. It makes history crash-tolerant and backfillable (the dashboard can be down
and lose nothing), it satisfies the “tokens never inferred” invariant naturally
(tokens come from the ground-truth log), and claude-code-templates already proves the
chokidar-watch-over-JSONL pattern works. Hard dependency: Phase-0 must confirm
JSONL actually carries the subagent parent→child linkage. If it does not, fall back to
hooks-primary + a local outbox/spool for at-least-once delivery — but only then.
Decision. Build the single-user Mac Mini tool. Adopt only the cheap commercial
hedges now — MIT-clean code only, instance/host key on rows, a schema that wouldn’t
block tenancy later — and explicitly defer every expensive commercial feature
(fleet aggregation, multi-tenant isolation).
Why. Resolves the identity split (concept §5.2) without paying for a product
nobody is using yet; keeps the door open at near-zero cost.
Decision. v1 must let Ivan answer, from real sessions:
node:sqlite fallback as portability
insurance). ✔ endorsed.packages/server, packages/web,
packages/shared (types/schema), hooks/ (installable hook scripts). Justified by
shared types across server/web; kiko-aligned.Decision. Remove “observability becomes memory” from the core delivery line;
label it future/experimental. It must not compete with shipping the cockpit.
Why. It’s a different product with a large undefined dependency (concept §5.3).
Decision. A single model_pricing seed (dated, with model IDs) is the source of
truth; a test asserts every model seen in fixtures has a price, and the constant
carries a “verified on
Decision. Telegram bot token via a launchd-injected env var (or a chmod 600
dotfile the service reads at boot); never stored in SQLite, never sent to the browser.
ANTHROPIC_API_KEY stays out of the dashboard env entirely (only the
experimental/Phase-3 track would need it, and it’s deferred).
simple10 and hoangsonww
(MIT + LICENSE), with attribution. From cast / disler / nirdiamant —
reimplement ideas clean-room; never copy source (all-rights-reserved / murky).
This is a hard rule, not a preference.90%**, blocking merges.
README with green-only badges (via the badges skill) + a
donation section; a GitHub Pages docs site (Vite/MkDocs-style) published by
CI; keep DESIGN/analysis cross-links honest.Objective: de-risk the concept’s two make-or-break unknowns before committing architecture. Throwaway code is fine.
Tasks
~/.claude/projects/*.jsonl: does it carry the subagent
parent→child linkage (spawn-tool invocations, subagent session ids, parent refs)?
Reconstruct the tree from JSONL alone in a scratch script.SubagentStart, PermissionRequest,
PostToolUseFailure; note which events carry which fields. (Use the
claude-code-guide agent / current Claude Code docs — do not assume the twelve.)Gate G0 (decision):
Definition of Done: a one-page spike report (append to WORKLOG.md) recording the
ingest decision, the verified hook catalog, and the tree/tokens confirmation. No
production code.
Answers daily-questions Q1–Q3, Q5. This is the first thing Ivan uses daily.
Scope
working → unknown state.projects, sessions, agents (self-ref parent_agent_id),
events, plus the persisted agent_edges table (the moat’s core:
parent_agent_id, child_agent_id, session_id, instance, derived_from_event_id,
created_at, idempotent). instance/host key on rows (D2 hedge). Forward-only
migration runner chosen and in place.127.0.0.1 only, mandatory DASHBOARD_TOKEN
(timingSafeEqual), SSE stream with same-origin check, WAL + backup.launchd (no Docker daemon); tested backup/restore; retention +
redaction policy for stored payloads.Cross-cutting (must land in this phase, not later):
Acceptance criteria (Definition of Done)
Σ token_usage == JSONL ground truth per session (reconciliation test passes).0.0.0.0; unauth write → 401/404 (constant-time); SSE rejects
cross-origin; no route spawns a subprocess from request input (all tested).SubagentStop yields an unknown state within the watchdog window,
not a permanently “working” agent.Answers Q3 remotely (“did anything get stuck/error while I was away?”).
Scope
formatTelegram provider + alert_rules / webhook_targets
/ webhook_deliveries subschema (MIT — copyable with attribution). Relay to
@baev_bot_bot.alert_rules for error / session-complete / quota; dedupe + rate-limit
alerts (a stuck loop must not spam); retries/backoff via webhook_deliveries.chmod 600), never in SQLite, never to the browser.Acceptance criteria
Answers Q4. (Re-sequenced ahead of the old vector-DB Phase 3 per D5.)
Scope
model_pricing as one dated constant, under test (D6). token_usage bucketed
by speed/geo/tier with compaction baselines preserved across PreCompact
(the subtle piece — designed feature, own tests, not a graft).analytics.ts): conservative
max(0, sonnetEquiv − actualHaiku) off ground-truth JSONL tokens.Acceptance criteria
PreCompact still prices correctly (compaction test passes).The differentiator no rival delivers.
Scope
agent_edges (built in Phase 1).Acceptance criteria
future/experimental: context-layer / vector-DB “observability becomes memory”
feed — the old Phase 3, parked per D5. Needs ANTHROPIC_API_KEY (out of the main
app’s env), an embedding pipeline, and nightly jobs. Not on the critical path.badges skill) + donation section present.WORKLOG.md entry appended (per the worklog skill).| Risk (concept §9.10) | Mitigated by | Phase |
|—|—|—|
| R1 JSONL can’t rebuild tree | G0 spike; JSONL-primary or outbox fallback | P0 |
| R2 Token double-count on replay | Idempotent upsert + replay test | P1 |
| R3 All-rights-reserved code copied | Clean-room rule; MIT-only copy | P0 policy / all |
| R4 Stale pricing | Dated constant + coverage test | P3 |
| R5 Scope diffusion | Daily-questions MVP; Phase-3 deferred | P0 / all |
| R6 Missed SubagentStop | Watchdog + unknown state | P1 |
| R7 Unbounded DB / full payloads | Retention + redaction policy | P1 |
| R8 Security drift | Invariant tests + grep gate in CI | P1 |
| R9 Hook-catalog assumptions | G0 verification | P0 |
| R10 Coverage theatre | CI gate blocking <90% | P1 |
WORKLOG.md.server / web / shared
/ hooks) with the CI coverage gate and security-invariant test harness wired in
from commit one — never retrofitted.docs/ai/DESIGN.md so the design of record reflects the
resolved decisions (SSE, JSONL-primary, clean-room licensing rule) and Ivan’s
delivery bar (coverage/badges/donation/Pages).Plan is a living document — revise as Phase 0 findings and real usage refine the sequencing. No code until the Part A decisions are approved and Gate G0 is green.