Skip to content

Commit 9574d84

Browse files
authored
feat: add handoff lint
1 parent cfaab12 commit 9574d84

9 files changed

Lines changed: 454 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5959
- `brigade handoff doctor` ingestor-log checks for stale latest-run logs, skipped malformed handoffs, warning summaries, and no-reply/no-update masking signals.
6060
- `brigade handoff issues` and `brigade handoff import-issues` to turn handoff ingest warnings into grouped repair guidance and local work imports.
6161
- `brigade handoff issues --category` and `brigade handoff import-issues --category` for category-limited handoff issue review/import.
62+
- `brigade handoff lint` to validate pending or explicit handoff files before ingest and catch card/document action mismatches that would be skipped later.
6263
- `docs/import-schema.md` documenting the local import JSONL contract for scanners and wrappers.
6364
- Cybersecurity plugin roadmap covering broad agent-workspace security checks plus Brigade-specific scanner, doctor, import, and multi-harness security checks.
6465
- Built-in `security` station and `brigade security scan` for read-only agent workspace security checks.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ brigade init --target ./repo --harnesses none # generic install
9595
Once installed, `brigade doctor` verifies the wiring and `brigade status` reports over the station registry.
9696
For machines that ingest handoffs from multiple repos, copy `.brigade/handoff-sources.example.json` to `.brigade/handoff-sources.json` and list the repo roots and writer inboxes the canonical ingestor scans.
9797
`brigade handoff doctor` reports pending `.claude/memory-handoffs/` and `.codex/memory-handoffs/` files that are not covered by that local source list.
98+
Run `brigade handoff lint` before ingesting pending handoffs when you want to catch action/target mismatches early.
9899
If your ingestor writes a latest-run log, set `ingestor.last_run_log` in that local config so the doctor can warn on stale runs, skipped malformed handoffs, and warning summaries hidden behind no-reply cron output.
99100
Use `brigade handoff issues` to group those warnings with repair guidance, then `brigade handoff import-issues` to route them into the normal local work import inbox.
100101

@@ -155,6 +156,7 @@ brigade dogfood
155156
brigade dogfood next
156157
brigade dogfood --target /path/to/repo
157158
brigade handoff doctor
159+
brigade handoff lint
158160
brigade handoff issues
159161
brigade handoff import-issues
160162
brigade work bootstrap
@@ -360,6 +362,7 @@ Handoff behavior:
360362
- By default it writes a reviewable handoff to `.claude/memory-handoffs/` under `--cwd`.
361363
- Use `--handoff-inbox <path>` for Codex, OpenCode, GPT, Hermes, OpenClaw, or another writer inbox.
362364
- The handoff targets `.learnings/LEARNINGS.md` as a `no-card` document update.
365+
- `brigade handoff lint` validates pending handoffs before ingest. Card actions require `Target card` plus `Suggested card content` and must omit document sections; `no-card` actions require document sections and must omit card sections.
363366
- The normal `brigade ingest` route can review or ingest that handoff.
364367
- If handoff writing fails after synthesis, Brigade still prints the final answer and keeps the final artifacts.
365368
- Failed handoff writes exit nonzero and mark `run.json` as `handoff-failed`.

ROADMAP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ Goal: prevent durable memory from silently rotting.
125125
- Add a handoff doctor that compares repo-local writer inboxes such as `.claude/memory-handoffs/` and `.codex/memory-handoffs/` against the canonical ingestor source list, warning when handoffs exist in directories the owner is not scanning. Status: started with `brigade handoff doctor`, `.brigade/handoff-sources.example.json`, and `brigade doctor` / `brigade work doctor` integration.
126126
- Add handoff-ingest observability checks for hidden warning states, including unreachable remote sources, malformed handoffs that are skipped, and runs that emit `NO_REPLY` despite warnings. Status: started with optional `ingestor.last_run_log` checks in `brigade handoff doctor`.
127127
- Turn handoff-ingest warnings into repairable local work. Status: started with `brigade handoff issues`, `brigade handoff import-issues`, repair guidance, and `brigade work brief` issue counts.
128+
- Catch handoff action/target mismatches before ingest. Status: started with `brigade handoff lint`, doctor warnings, issue imports, and template guidance that forces card and document handoffs into mutually exclusive branches.
128129

129130
## Later Phase: Portable Operator Setup
130131

src/brigade/cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ def _build_parser() -> argparse.ArgumentParser:
115115
p_handoff_doctor.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to inspect.")
116116
p_handoff_doctor.add_argument("--sources", type=Path, default=None, help="Override .brigade/handoff-sources.json.")
117117
p_handoff_doctor.add_argument("--json", action="store_true", help="Print machine-readable JSON.")
118+
p_handoff_lint = handoff_sub.add_parser("lint", help="Validate pending or explicit memory handoff files.")
119+
p_handoff_lint.add_argument("paths", nargs="*", type=Path, help="Handoff files to validate. Defaults to pending inbox files.")
120+
p_handoff_lint.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to inspect.")
121+
p_handoff_lint.add_argument("--json", action="store_true", help="Print machine-readable JSON.")
118122
p_handoff_issues = handoff_sub.add_parser("issues", help="Group actionable handoff ingest issues.")
119123
p_handoff_issues.add_argument("--target", "-t", type=Path, default=Path("."), help="Repo or workspace to inspect.")
120124
p_handoff_issues.add_argument("--sources", type=Path, default=None, help="Override .brigade/handoff-sources.json.")
@@ -678,6 +682,8 @@ def main(argv=None) -> int:
678682

679683
if args.handoff_command == "doctor":
680684
return handoff_cmd.doctor(target=args.target, sources=args.sources, json_output=args.json)
685+
if args.handoff_command == "lint":
686+
return handoff_cmd.lint(target=args.target, paths=args.paths, json_output=args.json)
681687
if args.handoff_command == "issues":
682688
return handoff_cmd.issues(
683689
target=args.target,

0 commit comments

Comments
 (0)