feat(directives): scavenge sweep 4/5 (tracks + commands + styleguides + todos): 18 batch-4 directives + concurrent worker batches

This commit is contained in:
ed
2026-07-04 02:00:42 -04:00
parent e8d3578f2e
commit 79124774ec
82 changed files with 2430 additions and 0 deletions
@@ -0,0 +1,7 @@
# tier2_pre_flight_audit_gates
## v1
**Why this iteration:** Lifted from `.agents/agents/tier2-tech-lead.md:46-51 (Pre-Commit Verification Gate — Step 2 audit_tier2_leaks.py --strict)` and the parallel `conductor/tier2/agents/tier2-autonomous.md` Pre-Action Required Reading list. The Tier 2 pre-flight audit gate is the audit-script analog to the workspace-state-preservation rule; it ensures every Tier 2 session starts and ends with the four enforcement scripts (tier2-leaks, weak-types, exception-handling, main-thread-imports) at exit 0.
**Source:** `.agents/agents/tier2-tech-lead.md:46-51 + conductor/tier2/agents/tier2-autonomous.md`
**Lifted:** 2026-07-03 scavenge sweep batch 5/5: guides + role prompts + transcripts
@@ -0,0 +1,41 @@
# Tier 2 audit gates are mandatory before every Tier 2 session — verify tier2 leaks, run-shape, and stale-API surface audits
From `conductor/tier2/agents/tier2-autonomous.md` and `.agents/agents/tier2-tech-lead.md`
§"MANDATORY: Pre-Commit Verification Gate" (lines 46-51):
> Before EVERY `git commit`, the agent MUST:
> 1. Run `git diff --cached --stat` — review for deletions. ABORT if any file shows `-N`.
> 2. Run `uv run python scripts/audit_tier2_leaks.py --strict` — must exit 0.
> 3. After `git commit`, run `git show HEAD --stat` — confirm the diff is non-empty. If empty, the sandbox hook stripped your commit. Treat this as a HARD ERROR.
## The 4-tier2 pre-flight audits
Tier 2 autonomous mode runs the following audit scripts at session start and
before each commit:
| Script | What it checks | Purpose |
|---|---|---|
| `scripts/audit_tier2_leaks.py --strict` | Files that escaped the sandbox (`opencode.json`, `mcp_paths.toml`, etc.) | Boundary enforcement |
| `scripts/audit_weak_types.py --strict` | New `dict[str, Any]` / `Any` / `Optional[T]` sites | Convention enforcement |
| `scripts/audit_exception_handling.py --strict` | `try/except/finally/raise` sites that violate the data-oriented error handling convention | Convention enforcement |
| `scripts/audit_main_thread_imports.py` | Module imports at the wrong thread domain | Architectural invariant |
## The first-run protocol
Before executing the first task of a Tier 2 autonomous session:
1. Run each of the 4 audits with `--strict` (or default-exit-1 mode) and
confirm exit 0. Capture the baseline output (the "before" numbers).
2. Save the baseline numbers to `scripts/tier2/artifacts/<track-name>/baseline.txt`
so the per-task deltas are auditable.
3. For any audit that fails: STOP. Do not start the track; the workspace is
already in a state the Tier 2 sandbox considers out-of-bounds.
## See also
- `conductor/directives/tier2_post_track_ruff_mypy_audit` — the end-of-track
Ruff/mypy sweep (the "post" analog to this "pre")
- `conductor/directives/tier2_pre_commit_deletion_and_diff_check` — the
pre-commit-level 3-step gate (the "pre" analog of this "pre-flight")
- `conductor/directives/config_state_owner` — the AppController-is-the-source-of-truth
rule that the tier2-leak audit protects