Skip to content

Draft timesheets: owner and agent hours, commits and PRs per project and client - #7

Merged
skmp merged 9 commits into
mainfrom
skmp/timesheet
Nov 27, 2026
Merged

skmp merged 9 commits into
mainfrom
skmp/timesheet

Conversation

@skmp

@skmp skmp commented Nov 27, 2026

Copy link
Copy Markdown
Member

Draft timesheets for the owner: per client, per project and per day, owner hours, agent hours, commits and pull requests, as Markdown, CSV and JSON under stateDir/timesheets/. Always a draft until the owner approves it; nothing is sent anywhere (no email, no upload), approved timesheets are only exported to files.

Contract: docs/SWITCHBOARD.md "Timesheet"; decisions in docs/DESIGN.md "Timesheet"; config and CLI in docs/REFERENCE.md.

Time rules

  • Agent-driven transcripts: subagent and workflow agent transcripts (new in dispatcher 0.10.0, id <session>:<agent>) and headless runs (entrypoint sdk-*: the hub's run_task tasks, ask and relay forks, claude -p scripts). Everything else is an owner-driven (interactive) session.
  • Chains: activity events (prompts, assistant lines) at most usage.idleGapMinutes apart. Every part lasts at least one minute.
  • Owner time: in an owner-driven session, a chain with a prompt the owner typed (not a task notification or compact summary, origin.kind) is owner time from the event just before that first prompt (the answer being read) to the chain's end, including the work it triggers. Plus every Switchboard tool call (start, end, project it targeted), chained the same way; calls without a project go to (voice) and count only where no project has owner time.
  • Agent time: agent-driven transcripts, chains without an owner prompt, the lead-in of a chain before that, sidechain lines inside a session.
  • Attribution: the time between two events belongs to the project of the later event: the repository (nearest .git above that line's cwd, dispatcher 0.10.0). Folders are mapped to configured projects (keys, aliases, globs) before any union. Unmapped folders are listed under "unassigned" with their hours, never guessed or dropped.
  • Per project and day (owner's timesheet.timeZone, DST aware, weeks Monday to Sunday): owner time is the union of owner parts and voice chains, agent time the union of agent parts, across sessions and machines. ownerOverlap: split (default) divides simultaneous owner time in several projects equally, so owner hours never exceed wall-clock hours; full counts it in each. Agent time is never split. Copies (forks, resumes) count once; on a tie the owner-driven transcript keeps them.
  • Rounding (roundingMinutes, default off): per project and day, owner and agent separately.
  • Limits: the Claude apps' own chat history is invisible; a voice conversation that never called a tool leaves no trace; work outside Claude Code is not seen (use adjustments); machines with a dispatcher older than 0.10.0 cannot tell headless runs and notifications apart (the draft notes them).

Commits and pull requests

Per configured project: repos through gh (default-branch commits by authorEmails, cut to the first message line by --jq on GitHub's side; PRs by githubLogins opened or merged in the period), paths (local clones inside projectRoots) through git log --all with hooks, fsmonitor and signature checks off. Only hashes, times, subjects, titles, numbers and URLs. Failures become notes.

Approval

  • Adjustments (hours, move to a configured project, note) are records on top of the computed numbers, never rewrites.
  • voice-coding-mcp timesheet approve [period] [--expect ID] or timesheet_approve + timesheet_approve_confirm (later turn, same OAuth client, minConfirmSeconds..confirmSeconds, single use, bound to the SHA-256 of the exact view read back) write <period>.approved.json once (O_EXCL) with a SHA-256; the period then takes no new draft or adjustment; export refuses drafts and changed files. Recorded in DESIGN.md as an exception to "nothing is approved by voice" (timesheet.voiceApproval: false turns it off).
  • Privacy: only times, project and client names, commit subjects, PR titles and the owner's notes; no prompt, screen or transcript text, no paths; files 0600 in a 0700 directory. The voice log stateDir/timesheets/voice.jsonl holds tool name, times and project folder only.

Dispatcher 0.10.0

The existing usage verb gains optional fields (agent transcripts, ep entrypoint, wp / p work projects, "o": "n" origins, "sc": 1 sidechains); the hub cache is version 2. usage_report ignores agent transcripts, so its numbers do not change. Connector bumped in step. Rebase note: the version lines (VERSION, test_dispatcher_keys.py, test_cli_remote.py) will conflict with #5 (0.7.0) and the clear-input (0.8.0) and incident (0.9.0) PRs; keep 0.10.0.

Tests

uv sync --locked, uv run ruff check, uv run ruff format --check, uv run mypy --strict src tests, uv run pytest: all pass (1910 passed, 9 skipped: live tmux and shellcheck tests that need tools not installed here; ruff, format and mypy clean).

New: tests/usage/test_dispatcher_agents.py, tests/timesheet/ (compute: owner vs agent vs sidechain, idle gaps, lead-in, unions, split/full, voice, renames, forks, midnight and week boundaries in Europe/Zurich, rounding; work: fake gh/git runners; service/store: end to end on hub transcripts with tests/fixtures/fake_gh.py, unassigned and ambiguous folders, adjustments, approval freeze, tamper check, file modes, privacy, config validation; tool/CLI: approval in a later turn, client binding, changed draft, expiry, voice approval off, the CLI flow), plus test_mcp.py (tool calls recorded without text) and the tool list snapshot. A read-only probe on a real Claude Code home (12 days, 828 transcripts) took 12 s and produced plausible per-project owner and agent hours.

Deploy and config

  1. Install dispatcher 0.10.0 on every machine (voice-coding-mcp remote-dispatcher > ~/.local/bin/switchboard-remote), and connector 0.10.0 on agent machines (voice-coding-mcp remote-connector), then restart the connectors. Check with voice-coding-mcp remote-check.
  2. Restart the hub. The first usage refresh reads every transcript again (cache version 2).
  3. Add a timesheet section to the deployed config (example in config.example.json): timeZone, clients (id to display name), projects (folder name to exactly one client, with aliases for worktrees and clones on other machines, repos as owner/name, optional paths inside projectRoots), authorEmails (your commit emails), githubLogins (your GitHub login). Personal addresses only in the deployed config.
  4. gh on the hub: check gh auth status as the hub user; if the hub's identity cannot read a client's repository, run voice-coding-mcp timesheet draft where gh is logged in with the hub's config and state dir.
  5. Use: voice-coding-mcp timesheet draft, show, adjust ... --note, approve --expect <id>, export --format csv --out ...; or by voice "what is on last week's timesheet?".

Not verified yet on the real setup (listed in DESIGN.md "To verify"): origin.kind values across Claude Code versions, the entrypoint of Remote Control sessions the hub starts, agent transcript paths in newer versions, gh pr list --search with times on the installed gh.

🤖 Generated with Claude Code

https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh

skmp and others added 9 commits November 27, 2026 15:07
…sage

The usage verb now also reports subagent and workflow agent transcripts
(<session>:<agent> ids), the entrypoint of each transcript, the repository
(work project) of each line's cwd, prompts the owner did not type ("o": "n")
and sidechain lines ("sc": 1). The hub parses and caches the new fields
(cache version 2). usage_report ignores agent transcripts, so its numbers do
not change; the timesheet uses them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
A timesheet section maps project folders to exactly one client each.
Owner time (interactive sessions from the owner's prompt on, voice calls)
and agent time (headless runs, subagents, chains without an owner prompt)
are computed per project and day in the owner's time zone, with unions,
an optional split of simultaneous owner time and optional rounding.
Commits and pull requests come from gh and local clones (subjects and
titles only). Drafts, adjustments and approvals live under
stateDir/timesheets, mode 0600; an approval freezes the period.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
Every tool call of the owner is recorded with its times and the project
folder it targeted (no text). timesheet_summary drafts and reads back a
period; timesheet_approve reads back the draft and timesheet_approve_confirm
approves it in a later turn, bound to that draft and the OAuth client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
…wner time

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
…gateway note)

SWITCHBOARD.md gets the Timesheet section, the timesheet config, the
dispatcher 0.10.0 usage additions, the tools and the milestone entry;
DESIGN.md records the decisions (separate owner and agent time, split of
simultaneous owner time, repository attribution, nothing sent, the voice
approval exception); REFERENCE.md the config keys, CLI and tools; both
example configs get a timesheet section with placeholders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
…t log hardening

On a tie between copies an owner-driven transcript keeps them, so an ask
fork of the owner's session does not turn its history into agent time.
An adjustment naming a project a new draft no longer has no longer breaks
the view. git log runs without signature checks (no gpg.program from a
repository's config). A failed background draft is logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
Union of both sides: dispatcher verbs version, list, capture, send, usage,
keys, resize, attachments, attachment, health; dispatcher and connector
stay 0.10.0 (deploy copies identical); config carries timesheet and
incidents; the MCP tool list has the timesheet and incident tools, then the
attachment tools, all guarded for the incident log and wrapped by the voice
activity log; tool list snapshot regenerated (23 tools); docs keep both
sets of rows and sections; guides state the dispatcher's new size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
@skmp
skmp merged commit 363a5b6 into main Nov 27, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant