Skip to content

Commit 2328c94

Browse files
authored
feat: bootstrap daily work loop
1 parent c976555 commit 2328c94

6 files changed

Lines changed: 355 additions & 32 deletions

File tree

.gitignore

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,15 @@ Thumbs.db
7070
# Managed by `brigade init`. Edit between the markers to customize.
7171
# Re-running `brigade init` replaces only the content between markers.
7272

73-
# Memory handoffs are session-local and may contain private context
74-
# (commands run, file paths, error strings). The TEMPLATE.md is the
75-
# only handoff file tracked in git.
73+
# claude: handoffs are session-local and may contain private context.
7674
.claude/memory-handoffs/*
7775
!.claude/memory-handoffs/TEMPLATE.md
7876
!.claude/memory-handoffs/.gitkeep
7977

80-
# Daily session logs are machine-local raw context. Promote durable
81-
# findings into memory/cards/ via the handoff flow instead.
78+
# Daily session logs are machine-local raw context.
8279
memory/20[0-9][0-9]-[0-1][0-9]-[0-3][0-9].md
8380

84-
# Review inbox: ambiguous handoffs awaiting human triage. Private.
81+
# Review inbox: ambiguous handoffs awaiting human triage.
8582
memory/handoff-inbox/
8683

8784
# brigade local state (logs, scrub cache, dogfood runs, work sessions).

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4040
- `brigade work run` to start a work session, run dogfood, close the session, write a work handoff, and print a recap in one command.
4141
- `brigade work resume` to show the active or latest work session, latest dogfood run, extracted next step, and suggested command.
4242
- `brigade work next` to resolve the next daily task without inspecting artifacts, plus `brigade work run` now uses the latest extracted next step when no task is passed.
43+
- `brigade work next --json` to expose the resolved daily task, active session, dogfood snapshot, and suggested command to wrappers.
44+
- `brigade work bootstrap` to initialize and verify the dogfood-backed daily work loop in one command.
4345
- `brigade work note` to append timestamped checkpoints to the active work session without ending it.
4446
- `brigade work doctor` to check dogfood config, Codex availability, local artifact paths, handoff inbox, ignore coverage, and latest run context for the daily work loop.
4547
- Workspace installs now include `.brigade/memory-care.example.json` as a scanner wiring contract for memory-care decay output.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,12 @@ brigade dogfood status
136136
brigade dogfood
137137
brigade dogfood next
138138
brigade dogfood --target /path/to/repo
139+
brigade work bootstrap
139140
brigade work status
140141
brigade work doctor
141142
brigade work resume
142143
brigade work next
144+
brigade work next --json
143145
brigade work run
144146
brigade work run "review today's changes"
145147
brigade work start "next slice"
@@ -169,7 +171,7 @@ CLI runs write artifacts by default under `.brigade/runs/<id>` below `--cwd`; do
169171

170172
Use `--output-dir <path>` to pick the artifact directory, or `--no-artifacts` for a throwaway run.
171173

172-
Use `brigade work status` as the quick daily dashboard for a repo. It reports the current branch, dirty files, dogfood readiness, configured dogfood paths, latest dogfood run, and extracted next step without starting a new orchestration. Use `brigade work doctor` to check whether the repo is ready for the daily loop: dogfood config, Codex CLI, local artifact paths, handoff inbox, ignore coverage, and latest run context. Use `brigade work resume` when returning to a repo; it shows the active or latest work session, latest dogfood run, extracted next step, and the suggested command to continue. Use `brigade work next` when you only need the task Brigade would run next. `brigade work run` is the one-command daily loop: it starts a work session, uses the latest extracted dogfood next step when no task is provided, runs `brigade dogfood`, ends the session, writes a work-session Memory Handoff by default, and prints a compact recap. Pass a task to override the resolved next step, `--title` to name the session, `--no-handoff` to skip the work handoff, or `--dogfood-handoff` to also let the underlying dogfood run write its own handoff. `brigade work start "title"` opens a local work session under `.brigade/work/<id>/`, records the starting git and dogfood context, and writes `start.md`. `brigade work note "checkpoint"` appends a timestamped note to the active session without ending it. `brigade work end --note "what happened"` closes the active session, records ending context, and writes `end.md`. Add `--handoff` to also write a Memory Handoff for the closed session; it defaults to the configured dogfood handoff inbox or `.codex/memory-handoffs`.
174+
Use `brigade work bootstrap` once in a repo to initialize the daily loop: it writes or verifies `.brigade/dogfood.toml`, creates local run and work artifact directories, creates the configured handoff inbox, updates the managed `.gitignore` block, and reports whether the repo is ready to run. Use `brigade work status` as the quick daily dashboard for a repo. It reports the current branch, dirty files, dogfood readiness, configured dogfood paths, latest dogfood run, and extracted next step without starting a new orchestration. Use `brigade work doctor` to check whether the repo is ready for the daily loop: dogfood config, Codex CLI, local artifact paths, handoff inbox, ignore coverage, and latest run context. Use `brigade work resume` when returning to a repo; it shows the active or latest work session, latest dogfood run, extracted next step, and the suggested command to continue. Use `brigade work next` when you only need the task Brigade would run next, or `brigade work next --json` for wrappers that want the active session, dogfood snapshot, resolved task, and suggested command as structured output. `brigade work run` is the one-command daily loop: it starts a work session, uses the latest extracted dogfood next step when no task is provided, runs `brigade dogfood`, ends the session, writes a work-session Memory Handoff by default, and prints a compact recap. Pass a task to override the resolved next step, `--title` to name the session, `--no-handoff` to skip the work handoff, or `--dogfood-handoff` to also let the underlying dogfood run write its own handoff. `brigade work start "title"` opens a local work session under `.brigade/work/<id>/`, records the starting git and dogfood context, and writes `start.md`. `brigade work note "checkpoint"` appends a timestamped note to the active session without ending it. `brigade work end --note "what happened"` closes the active session, records ending context, and writes `end.md`. Add `--handoff` to also write a Memory Handoff for the closed session; it defaults to the configured dogfood handoff inbox or `.codex/memory-handoffs`.
173175

174176
Memory and bootstrap readiness are part of the same operating-system health story. `brigade doctor` checks installed bootstrap files against built-in hard byte budgets so overgrown files fail before agents load truncated context. It also checks `memory/cards/*.md` budgets, verifies that `MEMORY.md` card links resolve under `memory/cards/`, and reports memory-care freshness from `memory/cards/decay/scan-latest.json`. Workspace installs include `.brigade/memory-care.example.json` as a scanner wiring contract for whatever scheduler or memory owner produces the decay files. Missing memory-care decay state is advisory for fresh installs, but corrupt scan or refresh-queue JSON fails once the loop is wired. Bootstrap truncation is treated as a hard failure to prevent, not a cosmetic warning; keep cards atomic and bootstrap files as slim indexes.
175177

src/brigade/cli.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,25 @@ def _build_parser() -> argparse.ArgumentParser:
116116
p_work_status.add_argument("--limit", type=int, default=12, help="Maximum dirty file entries to show.")
117117
p_work_doctor = work_sub.add_parser("doctor", help="Check whether the daily work loop is ready.")
118118
p_work_doctor.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to inspect.")
119+
p_work_bootstrap = work_sub.add_parser("bootstrap", help="Initialize and verify the daily work loop.")
120+
p_work_bootstrap.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to prepare.")
121+
p_work_bootstrap.add_argument("--artifacts-dir", type=Path, default=None, help="Directory for dogfood artifacts.")
122+
p_work_bootstrap.add_argument("--handoff-inbox", type=Path, default=None, help="Memory Handoff inbox.")
123+
p_work_bootstrap.add_argument("--force", action="store_true", help="Overwrite an existing dogfood config.")
124+
p_work_bootstrap.add_argument("--no-handoff", action="store_true", help="Disable work handoff defaults.")
125+
p_work_bootstrap.add_argument("--no-inspect", action="store_true", help="Do not inspect dogfood artifacts by default.")
126+
p_work_bootstrap.add_argument(
127+
"--native-read-only-sandbox",
128+
action="store_true",
129+
help="Use Codex's native read-only sandbox for dogfood runs.",
130+
)
131+
p_work_bootstrap.add_argument("--timeout-seconds", type=float, default=DEFAULT_TIMEOUT_SECONDS, help="Per-agent timeout.")
132+
p_work_bootstrap.add_argument("--no-gitignore", action="store_true", help="Do not update the target .gitignore.")
119133
p_work_resume = work_sub.add_parser("resume", help="Show the current work handoff point and next command.")
120134
p_work_resume.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to inspect.")
121135
p_work_next = work_sub.add_parser("next", help="Show the next daily work task and suggested command.")
122136
p_work_next.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to inspect.")
137+
p_work_next.add_argument("--json", action="store_true", help="Print machine-readable JSON.")
123138
p_work_list = work_sub.add_parser("list", help="List recent Brigade work sessions.")
124139
p_work_list.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to inspect.")
125140
p_work_list.add_argument("--limit", type=int, default=10, help="Maximum sessions to show.")
@@ -443,10 +458,22 @@ def main(argv=None) -> int:
443458
return work_cmd.status(target=args.target, limit=args.limit)
444459
if args.work_command == "doctor":
445460
return work_cmd.doctor(target=args.target)
461+
if args.work_command == "bootstrap":
462+
return work_cmd.bootstrap(
463+
target=args.target,
464+
artifacts_dir=args.artifacts_dir,
465+
handoff_inbox=args.handoff_inbox,
466+
force=args.force,
467+
handoff=not args.no_handoff,
468+
inspect=not args.no_inspect,
469+
native_read_only_sandbox=args.native_read_only_sandbox,
470+
timeout_seconds=args.timeout_seconds,
471+
update_gitignore=not args.no_gitignore,
472+
)
446473
if args.work_command == "resume":
447474
return work_cmd.resume(target=args.target)
448475
if args.work_command == "next":
449-
return work_cmd.next(target=args.target)
476+
return work_cmd.next(target=args.target, json_output=args.json)
450477
if args.work_command == "list":
451478
return work_cmd.list_sessions(target=args.target, limit=args.limit)
452479
if args.work_command == "latest":

0 commit comments

Comments
 (0)