Commit Graph

627 Commits

Author SHA1 Message Date
490fdc52d4 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 20:09:54 +02:00
1d4c4e31d9 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 19:56:00 +02:00
943be6fb97 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - T05: todo → done
2026-03-29 19:55:58 +02:00
99a8ba66e9 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - T04: todo → done
2026-03-29 19:55:58 +02:00
94aee3d845 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - T03: todo → done
2026-03-29 19:55:58 +02:00
df84198c2e chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - T02: todo → done
2026-03-29 19:55:58 +02:00
b36e7d469c chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - T01: todo → done
2026-03-29 19:55:58 +02:00
b0edfbb06f chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 19:41:23 +02:00
99cf8c8386 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 19:27:19 +02:00
5594f15590 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 19:26:40 +02:00
a728d04eae chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 19:11:52 +02:00
c763df3805 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 19:05:45 +02:00
bb965e4990 feat(token-tracking): repo aggregation via graph walk (task→workstream→repo)
By Repo now resolves via the full chain rather than requiring repo_id
directly on the token event:
  1. token_events.repo_id (direct)
  2. → workstreams.repo_id (via workstream_id)
  3. → task.workstream_id → workstreams.repo_id (via task_id)

Changes:
- Auto-populate repo_id on token events at creation time (both the
  token_events router and the tasks router)
- New GET /token-events/by-repo/ endpoint with RepoTokenSummary schema;
  returns tokens_in/out/total, event_count, by_model, by_note per repo
- Dashboard By Repo section uses /by-repo/ directly and shows repo_slug
  instead of a truncated UUID
- Backfilled the three existing events (userbased) with repo_id via SQL

185 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 19:05:23 +02:00
18b73f1e2b chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 18:57:46 +02:00
e19953f0b1 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 18:48:10 +02:00
68943684e1 feat(token-tracking): introduce token note taxonomy (measured/userbased/workplan/heuristic)
Tier 1 (exact counts) now defaults to note="measured" instead of null,
signalling the counts were read from the Claude Code status bar.
Callers can pass note="userbased" when a human provided the numbers.

  measured  — agent read exact counts from the Claude Code status bar
  userbased — counts provided by a human
  workplan  — prorated from workplan total across task count
  heuristic — server fallback, 1000/500, no agent input

Added token_note field to TaskUpdate schema and exposed note param on
update_task_status and record_interactive_task MCP tools.
TOOLS.md documents the full taxonomy. 185 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 18:47:40 +02:00
48e0dfc0ca chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 18:42:25 +02:00
e5c2ab4114 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 18:37:18 +02:00
edffc62775 feat(token-tracking): add record_interactive_task MCP tool
New tool for capturing ad-hoc work done outside formal workplans.
Finds or creates a persistent 'interactive-<repo>' workstream for the
repo, creates the task, marks it done, and records a token event using
the three-tier logic — all in a single call.

Seeded two example events on interactive-the-custodian:
  - Three-tier token recording on task done (8000/3500)
  - Add record_interactive_task MCP tool (4500/1800)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 18:36:51 +02:00
c0eec6e168 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 18:28:48 +02:00
e247c20439 feat(token-tracking): three-tier token recording on task done
Token events are now always created when update_task_status is called
with status="done", using the best available data:

  Tier 1 (best): exact tokens_in + tokens_out passed by agent
  Tier 2:        workplan_tokens_in + workplan_tokens_out prorated
                 across workstream task count (note="workplan")
  Tier 3 (fallback): heuristic 1000 in / 500 out (note="heuristic")

Non-done status changes never create a token event.
MCP tool updated with workplan_tokens_in/out params and tiered docs.
Ralph-workplan skill files updated with the three-tier guidance.
184 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 18:28:18 +02:00
3de29b5a9a chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 18:28:01 +02:00
c0f0e312c0 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 18:12:56 +02:00
174546699e chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 17:58:09 +02:00
7b8038f79f chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 17:47:13 +02:00
d65bc701da feat(token-tracking): record AI token consumption per task (CUST-WP-0029)
Introduces end-to-end token consumption tracking so agent work is
visible as a cost/effort metric alongside tasks and workplans.

- Migration o2j3k4l5m6n7: token_events table with FK indexes on
  task_id, workstream_id, repo_id, created_at
- ORM model, Pydantic schemas (TokenEventCreate, TokenEventRead with
  computed tokens_total, TokenSummary)
- Router: POST /token-events/, GET /token-events/ (7 filters),
  GET /token-events/summary/ (task|workstream|repo|commit|release scope)
- MCP tools: record_token_event, get_token_summary (formatted table)
- update_task_status enriched with optional tokens_in/tokens_out
  passthrough — one call creates status update + token event
- Dashboard token-cost.md page: by-repo bar, by-workplan table,
  by-model bar, top-10 tasks by tokens
- ralph-workplan skill updated with token reporting guidance and
  per-task heuristics for estimating counts
- Tests: test_token_events.py + test_token_passthrough.py (182 pass)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 17:46:46 +02:00
280f04c10d chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 17:43:17 +02:00
af6f0c7346 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 17:28:22 +02:00
bdf11f55fb chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 17:13:36 +02:00
c75d84bd67 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 16:58:41 +02:00
a4bd29b901 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 16:43:54 +02:00
c72a1654d3 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 16:29:08 +02:00
05e6abb3be chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 16:27:44 +02:00
015cf999a8 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 16:26:28 +02:00
af592401c0 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - CUST-WP-0029-T07: todo → done
2026-03-29 16:26:24 +02:00
aaca84dd46 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - CUST-WP-0029-T06: todo → done
2026-03-29 16:26:24 +02:00
422d869309 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - CUST-WP-0029-T05: todo → done
2026-03-29 16:26:24 +02:00
dc49ef13b7 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - CUST-WP-0029-T04: todo → done
2026-03-29 16:26:24 +02:00
c87a74904c chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - CUST-WP-0029-T03: todo → done
2026-03-29 16:26:24 +02:00
c76ee32206 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - CUST-WP-0029-T02: todo → done
2026-03-29 16:26:24 +02:00
b5c5ed8815 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - CUST-WP-0029-T01: todo → done
2026-03-29 16:26:24 +02:00
b41233c5d1 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 16:14:14 +02:00
f8e8d472d5 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 15:59:18 +02:00
5c1f1f509e chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 15:44:26 +02:00
a702f3a1d8 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 15:29:26 +02:00
d4e4f4ba2c chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 15:14:30 +02:00
bff03de438 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 14:59:33 +02:00
43408d838d chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 14:44:31 +02:00
33ce288359 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 14:29:32 +02:00
34e5fad47a chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-03-29:
  - update .custodian-brief.md for the-custodian
2026-03-29 14:17:55 +02:00