Skip to content

Commit df5b4ff

Browse files
committed
feat: add work import triage
1 parent 1d0a0b2 commit df5b4ff

6 files changed

Lines changed: 356 additions & 26 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4646
- `brigade work tasks` plus `brigade work task add/show/done` to manage a gitignored local task ledger under `.brigade/work/tasks.json`.
4747
- `brigade work run --queue-next` to queue the successful run's extracted next step, with duplicate pending task protection.
4848
- `brigade work import add/list/show/promote` to manage a gitignored local import inbox for scanner-discovered candidate work.
49+
- `brigade work import triage` to group pending imports by source and kind.
50+
- `brigade work import dismiss` to close noisy imports without promoting them.
51+
- `brigade work import promote --all` with optional `--source` and `--kind` filters for batch promotion.
4952
- `ROADMAP.md` covering the daily-driver path, scanner-ready inbox, chat-surface scanners, memory-card decay refresh, and portable operator setup.
5053
- `brigade work note` to append timestamped checkpoints to the active work session without ending it.
5154
- `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.
@@ -61,7 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6164
- Dogfood next-step extraction now handles markdown `## Next` sections and can fall back to `summary.md` when `final.txt` does not contain a next-step label.
6265
- `brigade work run` now consumes the oldest pending ledger task before falling back to the latest extracted dogfood next step, and marks consumed tasks done after successful runs.
6366
- `brigade work task add --from-next` now reuses an equivalent pending task instead of adding duplicates.
64-
- `brigade work brief` now includes pending local work imports in both text and JSON output.
67+
- `brigade work brief` now includes pending local work imports and import counts in both text and JSON output.
6568
- The managed gitignore block now treats `.brigade/dogfood.toml` and `.brigade/runs/` as local state.
6669
- Live smoke docs now keep Codex agent execution in a trusted repo cwd while writing temporary roster, artifacts, and handoff output under `/tmp`.
6770
- Handoff write failures now preserve final run artifacts, print the final answer, return nonzero, and mark `run.json` as `handoff-failed`.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ brigade work task add --from-next
152152
brigade work task done <task-id>
153153
brigade work import add --kind task --source slack "refresh the stale memory card"
154154
brigade work import list
155+
brigade work import triage
155156
brigade work import promote <import-id>
157+
brigade work import promote --all --source memory-care --kind task
158+
brigade work import dismiss <import-id> --reason "not actionable"
156159
brigade work run
157160
brigade work run --queue-next
158161
brigade work run "review today's changes"
@@ -183,7 +186,7 @@ CLI runs write artifacts by default under `.brigade/runs/<id>` below `--cwd`; do
183186

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

186-
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 brief` as the normal start-of-day command. It shows branch and dirty-file state, active and latest work sessions, pending local tasks, pending local imports, latest dogfood run, extracted next task, recent sessions, and the command to continue; add `--json` for wrappers. Use `brigade work tasks` to list the local task ledger stored in `.brigade/work/tasks.json`, `brigade work task add "..."` to queue work manually, `brigade work task add --from-next` to promote the latest extracted dogfood next step, and `brigade work task done <task-id>` to close queued work. Use `brigade work import add "..."` as a scanner-ready local inbox for candidate tasks, findings, decisions, preferences, incidents, links, and commands from systems such as chat crawlers or memory-care decay scans; imports are stored under `.brigade/work/imports/inbox.jsonl`, stay gitignored, and do not write memory directly. Use `brigade work import list`, `brigade work import show <import-id>`, and `brigade work import promote <import-id>` to review and promote an import into the task ledger with source metadata preserved. 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, consumes the oldest pending ledger task when no task is passed, otherwise uses the latest extracted dogfood next step, runs `brigade dogfood`, marks consumed ledger tasks done after successful runs, ends the session, writes a work-session Memory Handoff by default, and prints a compact recap. Add `--queue-next` to queue the successful run's extracted next step for the next session; duplicate pending task text is reused instead of added again. 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`.
189+
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 brief` as the normal start-of-day command. It shows branch and dirty-file state, active and latest work sessions, pending local tasks, pending local import counts by source and kind, latest dogfood run, extracted next task, recent sessions, and the command to continue; add `--json` for wrappers. Use `brigade work tasks` to list the local task ledger stored in `.brigade/work/tasks.json`, `brigade work task add "..."` to queue work manually, `brigade work task add --from-next` to promote the latest extracted dogfood next step, and `brigade work task done <task-id>` to close queued work. Use `brigade work import add "..."` as a scanner-ready local inbox for candidate tasks, findings, decisions, preferences, incidents, links, and commands from systems such as chat crawlers or memory-care decay scans; imports are stored under `.brigade/work/imports/inbox.jsonl`, stay gitignored, and do not write memory directly. Use `brigade work import triage` to group pending imports by source and kind, `brigade work import show <import-id>` to inspect one item, `brigade work import dismiss <import-id>` to remove noise from the pending queue, `brigade work import promote <import-id>` to promote one reviewed import into the task ledger, or `brigade work import promote --all --source memory-care --kind task` to batch-promote filtered pending imports with source metadata preserved. 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, consumes the oldest pending ledger task when no task is passed, otherwise uses the latest extracted dogfood next step, runs `brigade dogfood`, marks consumed ledger tasks done after successful runs, ends the session, writes a work-session Memory Handoff by default, and prints a compact recap. Add `--queue-next` to queue the successful run's extracted next step for the next session; duplicate pending task text is reused instead of added again. 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`.
187190

188191
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.
189192

ROADMAP.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ Status: in progress.
1616

1717
## Next Phase: Scanner-Ready Inbox
1818

19+
Status: in progress.
20+
1921
Goal: make Brigade a safe target for local automations that discover useful work.
2022

2123
- Keep raw scanner output private and gitignored under `.brigade/work/imports/`.
2224
- Normalize imports into small records with `kind`, `source`, text, timestamps, and metadata.
2325
- Let wrappers import candidate tasks, findings, decisions, preferences, incidents, links, and commands without knowing Brigade internals.
2426
- Promote selected imports into the work task ledger, with source metadata preserved.
25-
- Surface pending imports in `brigade work brief` so discovered work appears in the daily flow.
27+
- Dismiss noisy imports so scanners can be useful without leaving permanent queue clutter.
28+
- Batch-promote reviewed imports by source and kind.
29+
- Surface pending imports and grouped counts in `brigade work brief` so discovered work appears in the daily flow.
2630

2731
## Later Phase: Chat Surface Scanners
2832

src/brigade/cli.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,28 @@ def _build_parser() -> argparse.ArgumentParser:
180180
p_work_import_list.add_argument("--all", action="store_true", help="Include promoted imports.")
181181
p_work_import_list.add_argument("--json", action="store_true", help="Print machine-readable JSON.")
182182
p_work_import_list.add_argument("--limit", type=int, default=20, help="Maximum imports to show.")
183+
p_work_import_triage = import_sub.add_parser("triage", help="Group pending imports by source and kind.")
184+
p_work_import_triage.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to inspect.")
185+
p_work_import_triage.add_argument("--json", action="store_true", help="Print machine-readable JSON.")
186+
p_work_import_triage.add_argument("--limit", type=int, default=50, help="Maximum imports per group to show.")
183187
p_work_import_show = import_sub.add_parser("show", help="Show one work import.")
184188
p_work_import_show.add_argument("import_id", help="Import id or unique prefix.")
185189
p_work_import_show.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to inspect.")
186190
p_work_import_promote = import_sub.add_parser("promote", help="Promote one work import into the task ledger.")
187-
p_work_import_promote.add_argument("import_id", help="Import id or unique prefix.")
191+
p_work_import_promote.add_argument("import_id", nargs="?", help="Import id or unique prefix.")
188192
p_work_import_promote.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to update.")
193+
p_work_import_promote.add_argument("--all", action="store_true", help="Promote all pending imports matching filters.")
194+
p_work_import_promote.add_argument(
195+
"--kind",
196+
choices=["task", "finding", "decision", "preference", "incident", "link", "command"],
197+
default=None,
198+
help="Limit --all promotion to one kind.",
199+
)
200+
p_work_import_promote.add_argument("--source", default=None, help="Limit --all promotion to one source.")
201+
p_work_import_dismiss = import_sub.add_parser("dismiss", help="Dismiss one pending work import.")
202+
p_work_import_dismiss.add_argument("import_id", help="Import id or unique prefix.")
203+
p_work_import_dismiss.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to update.")
204+
p_work_import_dismiss.add_argument("--reason", default=None, help="Optional dismiss reason.")
189205
p_work_list = work_sub.add_parser("list", help="List recent Brigade work sessions.")
190206
p_work_list.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to inspect.")
191207
p_work_list.add_argument("--limit", type=int, default=10, help="Maximum sessions to show.")
@@ -556,10 +572,20 @@ def main(argv=None) -> int:
556572
json_output=args.json,
557573
limit=args.limit,
558574
)
575+
if args.import_command == "triage":
576+
return work_cmd.import_triage(target=args.target, json_output=args.json, limit=args.limit)
559577
if args.import_command == "show":
560578
return work_cmd.import_show(target=args.target, import_id=args.import_id)
561579
if args.import_command == "promote":
562-
return work_cmd.import_promote(target=args.target, import_id=args.import_id)
580+
return work_cmd.import_promote(
581+
target=args.target,
582+
import_id=args.import_id,
583+
all_matching=args.all,
584+
kind=args.kind,
585+
source=args.source,
586+
)
587+
if args.import_command == "dismiss":
588+
return work_cmd.import_dismiss(target=args.target, import_id=args.import_id, reason=args.reason)
563589
parser.error(f"unknown import command: {args.import_command}")
564590
return 2
565591
if args.work_command == "list":

0 commit comments

Comments
 (0)