stewardkit 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
stewardkit/__init__.py ADDED
@@ -0,0 +1,7 @@
1
+ """Multi-harness orchestration, intent-first review sweep, and test-parity toolkit."""
2
+
3
+ from __future__ import annotations
4
+
5
+ __version__ = "0.1.0"
6
+
7
+ __all__ = ["__version__"]
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "stewardkit",
3
+ "version": "0.1.0",
4
+ "description": "Multi-harness specialist orchestration, intent-first quality bar, frozen read-only review sweeps, and findings tracking for software repositories.",
5
+ "author": {
6
+ "name": "Mitchell Abbott"
7
+ },
8
+ "repository": "https://github.com/mitchell-abbott/stewardkit",
9
+ "license": "MIT",
10
+ "keywords": [
11
+ "workflow",
12
+ "code-review",
13
+ "orchestration",
14
+ "multi-agent",
15
+ "skills",
16
+ "quality-bar",
17
+ "triage"
18
+ ],
19
+ "skills": "./skills"
20
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "stewardkit",
3
+ "displayName": "StewardKit",
4
+ "description": "Multi-harness specialist orchestration, intent-first quality bar, frozen read-only review sweeps, and findings tracking for software repositories.",
5
+ "version": "0.1.0",
6
+ "author": "Mitchell Abbott",
7
+ "repository": "https://github.com/mitchell-abbott/stewardkit",
8
+ "suggestedPrompts": [
9
+ "Use steward-init to onboard this new or existing repository and pre-populate its workflow docs and rules.",
10
+ "Run a diff-scoped review sweep on the current feature branch before merging to the default branch.",
11
+ "Verify intent alignment and tests-doc parity against .stewardkit.toml for this repository."
12
+ ]
13
+ }
@@ -0,0 +1,20 @@
1
+ # Standing Workflow Rules
2
+
3
+ Check `.stewardkit.toml` (or `stewardkit config`):
4
+
5
+ - **Project mode (`.stewardkit.toml` present):** `.stewardkit.toml`, its synced `<!-- stewardkit:start/end -->` block, and `steward-*` skills are authoritative; user config only fills fallbacks for the 7 personal/machine allowlisted keys.
6
+ - **Global mode (no `.stewardkit.toml`):** Zero-footprint — **never** create `.stewardkit.toml`, `AGENTS.md`, `docs/findings.md`, or `docs/nits/` inside the repo. Respect existing repo rules first; infer default branch (`origin/HEAD` -> `main`/`master`; skip git steps in non-git folders); use `~/.config/stewardkit/config.toml` (`stewardkit user-config init`); keep findings/nits in chat (or external state dir if `projectless.state_mode = "external"`); stay silent when `mode = "excluded"` (`projectless.exclude_paths`).
7
+
8
+ ## Core Defaults
9
+
10
+ - **Adaptive `orchestration_mode`:** Under `subagents`/`auto` with subagents, delegate to user-level specialist skills while the lead orchestrates; never copy skills into repos. Under `single-agent`/`auto` fallback, switch hats per phase with a clean-diff read-only review — never fabricate delegation.
11
+ - **Branch-and-sweep:** Code on a feature branch (never `git.default_branch`); deliver (`pull-request`/`direct-merge`) only after a frozen, diff-scoped read-only sweep clears with 0 kept findings (ask owner if no sweep skill exists).
12
+ - **Intent-first Bar vs. nits:** `docs.intent` (or user request + repo docs in Global mode) is source of truth. Only the 7 Bar items (bugs, bad alerts, safety bypasses, wrong docs, doc-reading tests, opt-in `docs.tests` parity, avoidable manual steps) are findings; nits go to `docs.nits_dir/<category>.md` (or chat/external state).
13
+ - **Config & safety:** `.stewardkit.toml` owns shared policy; gitignored `.stewardkit.local.toml` overrides only the 7 personal/machine keys. Never force-push, stage `git.blocked_staged_globs`, or alter `bar.protected_files`/safety guards unapproved.
14
+
15
+ ## Bundled Skills
16
+
17
+ - `steward-init` — Onboarding, profiles, `user-config`, config/local overrides, `doctor`.
18
+ - `steward-orchestrate` — Orchestration, Global mode, canonical rules, branching, coherence, hygiene.
19
+ - `steward-sweep` — Checkpoint, frozen review, triage, class fixes, fresh re-reviews, delivery, cleanup.
20
+ - `steward-intent-bar` — Intent authority, The Bar, nits, `real_cases_only`, test parity, findings.
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: steward-init
3
+ description: >-
4
+ Onboards a new or existing repo onto StewardKit: selects a profile,
5
+ configures .stewardkit.toml and optional gitignored .stewardkit.local.toml,
6
+ runs stewardkit init around existing rules, pre-populates docs, and verifies
7
+ stewardkit doctor. Use when setting up workflow config, rules, or docs.
8
+ ---
9
+
10
+ # Workflow Onboarding & Initialization
11
+
12
+ ## When to use
13
+
14
+ Onboard a **new repo (Mode A)** (no established code/tests/docs) or an **existing repo (Mode B)** (existing code, tests, docs, rules, or git history — always work on a feature branch such as `chore/init-stewardkit`, never `git.default_branch`).
15
+
16
+ Related skills: `steward-orchestrate` (orchestration, canonical repo rules, hygiene), `steward-intent-bar` (intent, The Bar, nits, `real_cases_only`, parity), `steward-sweep` (pre-delivery sweep).
17
+
18
+ ## Procedure
19
+
20
+ ### Profile Defaults (`--profile`)
21
+
22
+ Explicit CLI flags or `.stewardkit.toml` keys override profile defaults:
23
+
24
+ | Setting | `light` | `standard` (default) | `strict` |
25
+ | --- | --- | --- | --- |
26
+ | `orchestration_mode` | `auto` | `auto` | `subagents` |
27
+ | `git.delivery_mode` | `direct-merge` | `pull-request` | `pull-request` |
28
+ | `bar.require_tests_doc_parity` | `false` | `false` | `true` |
29
+ | `bar.no_test_figures_in_docs` | `false` | `true` | `true` |
30
+ | `bar.real_cases_only` | `false` | `false` | `false` |
31
+ | `hygiene.max_followups_before_checkin` | `0` | `2` | `2` |
32
+ | `hygiene.allow_overnight_loops` | `false` | `false` | `false` |
33
+
34
+ - Solo owners on `strict` wanting direct merges pass `--delivery-mode direct-merge`.
35
+ - `hygiene.min_free_disk_gb` defaults to `5.0` (`0` disables; `hygiene.disk_check_path = ""` checks repo root).
36
+ - `--scaffold-docs` under `light` creates only `docs.intent` and `docs.how_it_works`; under `standard`/`strict` it adds `docs.findings` (when non-empty) and `<nits_dir>/README.md` (when `nits_dir` is non-empty); `docs.tests` is scaffolded only when `bar.require_tests_doc_parity = true`. Directory-configured doc paths (no `.md` suffix, or existing directories) scaffold `<dir>/README.md`.
37
+
38
+ ### `init` Flags, Lifecycle Commands, & Local Overrides
39
+
40
+ All 8 CLI subcommands support `--json` for CI/automation. All repo commands accept an optional `[PATH]` defaulting to `.`: `config`, `sync`, `uninstall-repo`, `check-tests`, and `doctor` walk upward from nested subdirectories to the nearest `.stewardkit.toml` (stopping at `.git` boundaries), while `init` always targets the exact requested directory. Install global workflow skills separately via `stewardkit install-global` (auto-detects installed harnesses by default; pass `--harnesses ...` or `--all`; never copy skills into repos).
41
+
42
+ - **`stewardkit init` flags:** `--profile`, `--orchestration-mode`, `--delivery-mode`, `--require-tests-doc-parity` / `--no-require-tests-doc-parity`, `--harnesses`, `--antigravity-file` (`AGENTS.md`|`GEMINI.md`), `--junie-legacy-guidelines`, `--copilot-apply-to`, `--default-branch`, `--merge-strategy` (`no-ff`|`squash`|`ff-only`), `--min-free-disk-gb`, `--disk-check-path`, `--timezone` (`local`|IANA), `--clock-format` (`12h`|`24h`), `--nits-dir`, `--test-roots`, `--real-cases-only`, `--recommended-specialist-catalog`, `--scaffold-docs`, `--update-gitignore`, `--full`, `--force`, `--dry-run`, `--json`.
43
+ - **Fail-closed, minimal TOML & `schema_version`:** existing `.stewardkit.toml` blocks `init` unless `--force` is passed (prefer editing `.stewardkit.toml` + `stewardkit sync`). `init` writes `schema_version = 1` and omits profile-matching keys by default so changing `profile` switches them automatically (`--full` writes all keys explicitly). Newer `schema_version` values ignore unknown keys/tables with advisory warnings in `config` and `doctor`.
44
+ - **Directory-or-file docs & findings opt-out:** `docs.intent`, `docs.how_it_works`, `docs.tests`, and `docs.findings` accept either a `.md` file or a directory path (e.g., `docs/tests` for multi-file parity scanning, skipping `README.md` and symlinks). Setting `docs.findings = ""` opts out of `docs/findings.md` for PR-only teams and omits it from default `bar.exempt_review_files`.
45
+ - **Inspect & uninstall:** `stewardkit config [--home <dir>] [--json]` auto-detects `project`, `global`, or `excluded` mode and prints `git_repo`, `inferred_default_branch`, `user_config`, `[stewardkit.projectless]` (including `external_state_dir` in `global` mode when `state_mode = "external"`), `resolved_timezone`, `user_overrides`, `local_overrides`, `warnings`, and per-key provenance (`default`|`profile`|`user`|`shared`|`local`). `stewardkit uninstall-repo [--remove-config] [--dry-run] [--json]` strips managed blocks cleanly while preserving user rules, EOLs, and POSIX modes.
46
+ - **User-level config & 4-layer precedence (`stewardkit user-config {init,path,show}`):** Cross-OS `~/.config/stewardkit/config.toml` (`$XDG_CONFIG_HOME` / `%APPDATA%`) configures personal/Global Mode defaults plus `[stewardkit.projectless]` (`state_mode = "chat" | "external"`, `exclude_paths`). Resolution follows 4 layers (`profile -> user -> shared -> local`): in `project` mode user config fills only omitted keys from the 7-key personal/machine allowlist; in `global` mode full user defaults apply with zero repo files created; paths matching `exclude_paths` (without `.stewardkit.toml`) enter `excluded` mode.
47
+ - **`.stewardkit.local.toml` (gitignored via `--update-gitignore`, in default `blocked_staged_globs`):** allows **only 7 personal/machine keys**: `[stewardkit]` (`orchestration_mode`, `recommended_specialist_catalog`), `[stewardkit.docs]` (`timezone`, `clock_format`), `[stewardkit.hygiene]` (`min_free_disk_gb`, `disk_check_path`, `allow_overnight_loops`). Every shared key/table (`schema_version`, `[stewardkit.bar]`, `[stewardkit.git]`, `[stewardkit.tests]`, `profile`, harness/sync keys, doc paths, `hygiene.max_followups_before_checkin`, and user-only `[stewardkit.projectless]`) is locked out of `.stewardkit.local.toml` and raises `ConfigError`.
48
+
49
+ ### Mode A — New Project
50
+
51
+ 1. **Interview concisely** (one question at a time when ambiguous): goal, safety invariants, non-goals, profile, harnesses, delivery mode, test layout (ask `bar.real_cases_only` only for external-world/real-data domains).
52
+ 2. **Run `stewardkit init ... --scaffold-docs --update-gitignore`**, tune any non-CLI keys (e.g., `tests.ignore_globs`, custom/directory `docs.*`, or `docs.findings = ""`), inspect `stewardkit config`, and run `stewardkit sync`.
53
+ 3. **Draft starter docs** (via Technical Writer when delegating): `docs.intent` tagged `(Owner)`, `docs.how_it_works` tagged `(Owner, intent N.M)` / `(Default)`, plus `docs.tests` (only if parity enabled) and `docs.findings` / `<nits_dir>/README.md` (unless `light` or disabled).
54
+ 4. **Verify** via `## Verification`. Suggest `recommended_specialist_catalog` optionally only if no user specialist skills exist locally.
55
+
56
+ ### Mode B — Existing Project
57
+
58
+ Never overwrite existing docs unapproved; never leave blank placeholder stubs.
59
+
60
+ 1. **Discover (read-only):** inspect `README.md`, existing rule files (`AGENTS.md`, `GEMINI.md`, `CLAUDE.md`, Copilot/Junie), `.gitignore`, `git log`, test languages/roots (`check-tests` parses Python and JS/TS/TSX), and chat context.
61
+ 2. **Run `stewardkit init --update-gitignore` first** with detected flags (`--antigravity-file GEMINI.md` if `GEMINI.md` exists; keep parity off for non-Python/JS suites).
62
+ 3. **Tune non-CLI keys & sync:** set `tests.ignore_globs` / `docs.*` (file, directory, or `docs.findings = ""`) / `bar.*` (align `bar.exempt_review_files` if manually changing `docs.nits_dir` or `docs.findings`), run `stewardkit config` and `stewardkit sync`, and check `git diff` confirms unmanaged rules stayed byte-identical.
63
+ 4. **Pre-populate real drafts:** `docs.intent` with `(Owner)` vs `(Inferred — confirm)`, `docs.how_it_works`, `docs.tests` via `stewardkit check-tests` (if parity enabled, organized by behavioral category), and `docs.findings` / `<nits_dir>/README.md` (unless `light` or disabled).
64
+ 5. **Confirm inferred intent** with the owner before locking `docs.intent`.
65
+
66
+ ## Pitfalls
67
+
68
+ - **Using `init --force` after manual TOML edits:** overwrites custom settings; edit `.stewardkit.toml` and run `stewardkit sync` instead.
69
+ - **Locked keys in or git-tracking `.stewardkit.local.toml`:** fails `doctor` (`local_config` / `git_hygiene`); use `--update-gitignore` to ignore it safely.
70
+ - **Enabling parity on non-Python/JS repos:** keep `bar.require_tests_doc_parity = false` unless on Python or JS/TS/TSX.
71
+ - **Confusing `init` with `install-global` or copying specialist skills into repos:** workflow and specialist skills stay global.
72
+ - **Onboarding directly on `git.default_branch` or leaving empty stubs:** branch first on existing repos and backfill from real code/history.
73
+
74
+ ## Verification
75
+
76
+ ```bash
77
+ stewardkit config
78
+ stewardkit sync --check
79
+ stewardkit check-tests # when bar.require_tests_doc_parity = true
80
+ stewardkit doctor
81
+ ```
82
+
83
+ Confirm: (1) `git diff` keeps unmanaged rules outside markers byte-identical; (2) `.stewardkit.local.toml` is gitignored and untracked; (3) all `(Inferred — confirm)` intent items are surfaced to the owner; (4) existing-repo onboarding is on a feature branch ready for `steward-sweep`.
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: steward-intent-bar
3
+ description: >-
4
+ Defines owner intent authority, The Bar for valid findings, categorized nits
5
+ under docs.nits_dir, optional bar.real_cases_only gate, test/doc parity
6
+ standards, protected-file locks, and findings tracking. Use during planning,
7
+ reviews, triage, and doc or test updates.
8
+ ---
9
+
10
+ # Intent Authority, The Bar, and Test/Doc Standards
11
+
12
+ ## When to use
13
+
14
+ Use during planning, implementation, review sweeps, triage, and doc/test updates to separate valid findings from non-blocking nits and keep docs aligned with app behavior. Read `.stewardkit.toml` first — `bar`, `docs` paths, and `tests` are locked to shared config (never overridden locally).
15
+ - **Automatic Global Mode (no `.stewardkit.toml`):** Treat the user's request/ticket plus existing repo README/docs as intent, skip `docs/tests.md` parity, run `stewardkit check-tests --doc-readers-only` when checking Python test suites, and record nits in chat or the external per-repo state dir rather than inside the repo.
16
+
17
+ Related skills: `steward-init` (profiles & config), `steward-orchestrate` (orchestration & hygiene), `steward-sweep` (sweep execution).
18
+
19
+ ## Procedure
20
+
21
+ ### 1. Owner Intent & Protected-File Lock
22
+
23
+ - **`docs.intent` is source of truth:** any gap between code/tests and `docs.intent` is a valid finding.
24
+ - **Same-turn propagation:** when an owner decision changes in `docs.intent`, update every repo location stating it (`README.md`, `docs.how_it_works`, comments) in the same turn with `(Owner, intent N.M)` vs. `(Default)` tags.
25
+ - **Owner-approval lock (`bar.protected_files`):** never narrow a rule, alter owner quotes/attributions, or mark a protected item `Dropped` without showing exact wording and receiving explicit owner approval.
26
+
27
+ ### 2. The Bar (The ONLY Valid Findings)
28
+
29
+ An issue is a finding **only** if it matches one of these 7 items:
30
+ 1. **Bug** — wrong logic, broken state, wrong output, data corruption, or anything skewing downstream behavior/evaluation.
31
+ 2. **Bad alert** — wrong, misleading, noisy, or high-volume alert/notification.
32
+ 3. **Bypassed safety/security rule** — weakened auth, isolation, halts, cutoffs, caps, or deploy guards.
33
+ 4. **Incorrect docs** — docs contradicting actual behavior, config, CLI flags, or `docs.intent`.
34
+ 5. **Non-behavioral test** — a test under `tests.roots` (honoring `tests.ignore_globs`) reading repo Markdown docs (`README.md`, `docs/*`, `AGENTS.md`) or another test file to assert wording (`tests.check_doc_readers = true`). Testing runtime text emitted by the app itself (alerts, CLI output, errors) *is* behavioral.
35
+ 6. **Tests-doc parity gap** *(when `bar.require_tests_doc_parity = true`)* — test missing from `docs.tests`, stale after removal, under the wrong heading, duplicated, or misdescribed.
36
+ 7. **Avoidable manual owner step** — asking the owner to run commands, edit files/env vars, log into dashboards, or copy values when automation or an agent can handle it.
37
+
38
+ ### 3. Categorized Out-of-Bar Nits (`docs.nits_dir`)
39
+
40
+ Wording polish, style, speculative coverage edges, minor refactors, and DX polish are **not** findings and are never fixed unasked.
41
+ - When `docs.nits_dir` is non-empty (outside streamlined `light` ceremony), log them in **`<nits_dir>/<category>.md`** — strictly **one `.md` file per category** (`style.md`, `wording.md`, `coverage.md`, `refactor.md`, `dx.md` — never one giant `nits.md`).
42
+ - Exempt via `bar.exempt_review_files`, statuses `Open`/`Done`/`Wontfix`, never block merges, cleaned up strictly on the owner's schedule.
43
+
44
+ ### 4. Optional Real Cases Only Gate (`bar.real_cases_only`)
45
+
46
+ - **Enable (`true`):** external-world, real-data, or integration-heavy domains with unbounded edge cases (financial/billing/tax engines, ETL/scrapers/third-party APIs, regulated workflows).
47
+ - **Leave off (`false`, default):** general libraries, CLIs, compilers, dev tools, and standard CRUD/UI apps where boundary tests shouldn't need external citations.
48
+
49
+ When `bar.real_cases_only = true`:
50
+ - Domain edge cases in code, tests, or findings require a verified real instance: (1) entity/subject, (2) exact dates, (3) primary/credible source (filing, spec, news, post-mortem).
51
+ - **Cite once:** beside the pinning test in `docs.tests` when `bar.require_tests_doc_parity = true`, **or** in the pinning test's docstring/comment when `bar.require_tests_doc_parity = false`.
52
+ - Remove unbacked hypotheticals ("could/might happen", doc-only claims, memory, near-matches) without asking; **never** cut core safety/intent guards (auth, isolation, halts, cutoffs, caps) as "hypothetical."
53
+
54
+ ### 5. Tests, Parity, & Findings Tracking
55
+
56
+ - **Pin invariants in unit tests**, never Markdown checklists; never hand-validate outputs by eyeballing logs.
57
+ - **Zero test figures in docs (`bar.no_test_figures_in_docs = true`):** keep concrete test inputs, expected counts/amounts, and computed comparisons out of `.md` files (app config defaults are not test figures).
58
+ - **Opt-in 1:1 `docs.tests` parity (`bar.require_tests_doc_parity`):** `stewardkit check-tests` parses Python (`Test*`, `unittest.TestCase`, nested classes) and JS/TS/TSX (modern modifiers, `describe`-scoped duplicates), always runs when invoked directly, and warns (`unsupported_lang`) on non-Python/JS repos. When enabled, group `docs.tests` by behavioral category + `### <relative/path>` and update it in the same change.
59
+ - **`docs.findings`:** keep overview tables current using `docs.timezone` (`local` = local TZ, fallback `UTC`) and `docs.clock_format`, edited by a Technical Writer outside review freezes. Preserve rejected items marked **`Dropped`** with reasons; edits touching only `bar.exempt_review_files` never re-trigger sweeps.
60
+
61
+ ## Pitfalls
62
+
63
+ - **Fixing nits unasked or creating one `nits.md`:** split non-bar notes into `<nits_dir>/<category>.md` for owner-scheduled cleanup.
64
+ - **Leaking test figures into `.md` or writing doc-reading tests:** assert behavior and figures in unit tests only.
65
+ - **Misapplying `real_cases_only` or bypassing owner locks:** drop hypotheticals, keep safety/intent guards, and get approval before editing `bar.protected_files`.
66
+ - **Erasing `Dropped` history or editing during review freeze:** keep dropped reasons and wait until reviews end before updating `docs.findings`/`docs.nits_dir`.
67
+
68
+ ## Verification
69
+
70
+ 1. Every kept finding maps to one of the 7 Bar items (with entity/dates/source in `docs.tests` or test docstring/comment when `bar.real_cases_only = true`).
71
+ 2. `docs.intent` changes are propagated to `README.md`, `docs.how_it_works`, and comments in the same turn.
72
+ 3. When `bar.require_tests_doc_parity = true`, `stewardkit check-tests` reports `missing=0`, `extra=0`, `wrong_section=0`, `duplicates=0`, `doc_readers=0`, with categorized headings and zero leaked test figures.
73
+ 4. `docs.findings` uses configured timezone/clock format, keeps `Dropped` items with reasons, and nits live only under `<nits_dir>/<category>.md`.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: steward-orchestrate
3
+ description: >-
4
+ Guides adaptive orchestration (subagents or phased single-agent fallback),
5
+ profile pacing, canonical unmanaged repo rules, branch-first setup, coherence
6
+ checks, active monitoring, anti-loop guardrails, and disk/scratchpad hygiene.
7
+ Use when coordinating multi-step work in a repo.
8
+ ---
9
+
10
+ # Workflow Orchestration
11
+
12
+ ## When to use
13
+
14
+ Use whenever planning, delegating, or coordinating work in a repo. Read `.stewardkit.toml` (plus valid user-level and gitignored `.stewardkit.local.toml` overrides; see `steward-init` for the 4-layer precedence, profile table, and 7-key allowlist).
15
+ - **Automatic Global Mode (no `.stewardkit.toml`):** Run zero-footprint (never create kit files inside the repo), respect existing repo rules/conventions first, skip git steps in non-git scratch folders, and stay silent when `stewardkit config` reports `mode = "excluded"`.
16
+
17
+ Related skills: `steward-init` (onboarding & profiles), `steward-intent-bar` (intent, The Bar, nits, locks), `steward-sweep` (pre-delivery sweep).
18
+
19
+ ## Procedure
20
+
21
+ ### 1. Adaptive Orchestration (`orchestration_mode`) & Profile Pacing
22
+
23
+ Check effective `profile` and `orchestration_mode` (`auto` | `subagents` | `single-agent`):
24
+
25
+ - **Profile pacing:** `light` (fast solo: `auto`, `direct-merge`, minimal docs, streamlined review); `standard` (balanced team: `auto`, `pull-request`, opt-in parity, follow-up cap `2`); `strict` (maximum rigor: `subagents`, `pull-request`, parity required, follow-up cap `2`).
26
+ - **`auto` (default):** use **Subagent Delegation** when subagent tools exist; otherwise run **Phased Single-Agent Fallback** — never fabricate delegation.
27
+ - **`subagents`:** require specialist delegation; if the harness lacks subagent tools, ask the owner to switch harnesses or set `orchestration_mode = "auto"`/`"single-agent"` in `.stewardkit.local.toml`.
28
+ - **`single-agent`:** execute phases sequentially in one session.
29
+
30
+ #### Subagent Delegation (when active)
31
+
32
+ - Delegate execution to matching user-installed specialist skills (never copy skills into repos; suggest `recommended_specialist_catalog` optionally only if none exist locally): code → engineering; tests/QA → test specialist; docs/`docs.findings`/`docs.nits_dir` → technical writer; conflicts → architecture; triage → domain specialist distinct from the reviewer; git → git specialist; research → research; cleanup → devops/cleanup.
33
+ - **Lead only orchestrates:** select specialists, enforce order/freezes/hygiene, talk to the owner, run quick read-only checks (`git status`, free disk), and record owner rules from chat into the repo's canonical rules file. Fold small edits into the next specialist's brief; state why if a rare exception occurs.
34
+
35
+ #### Phased Single-Agent Fallback (`single-agent`, or `auto` without subagents)
36
+
37
+ - **Never fabricate delegation.** Switch hats explicitly per phase: (1) Architect coherence check → (2) Implementer/Test edits → (3) Technical Writer doc updates → (4) Checkpoint commit + isolated read-only Reviewer pass (`steward-sweep`) + separate Triage pass → (5) Git delivery & cleanup.
38
+
39
+ ### 2. Canonical Unmanaged Repo Rules
40
+
41
+ Prevent multi-harness drift by recording project-specific rules (outside `<!-- stewardkit:start/end -->`) in **one canonical file** — `AGENTS.md` (or `GEMINI.md` if Antigravity-only) — and pointing secondary harness files (`CLAUDE.md`, Copilot instructions, `.junie/guidelines.md`) to it instead of duplicating rules.
42
+
43
+ ### 3. Branch-First Workflow & Coherence Checks
44
+
45
+ 1. **Branch first:** verify `git.default_branch` is clean, then branch via git specialist: `git switch --no-track -c <branch-name> <default_branch>`. Never commit new work onto `git.default_branch`.
46
+ 2. **Disjoint parallel ownership:** assign non-overlapping file paths to concurrent writers so two subagents never edit the same file.
47
+ 3. **Whole-round coherence check (before editing):** map planned changes across files/interfaces so fixes cannot undo each other. Settle same-spot conflicts via an architecture specialist (or Architect phase) so the result satisfies every finding, passes both test sets, and is logged under **"Same-spot choices"** in `docs.how_it_works`.
48
+
49
+ ### 4. Monitoring, Guardrails, & Hygiene
50
+
51
+ - **Active monitoring:** stop scope creep, reviewer edits during freeze, forbidden actions (deploying, force-pushing, staging `git.blocked_staged_globs`, runaway tests), and low disk space immediately; escalate stalls right away.
52
+ - **Anti-loop guardrails:** honor `hygiene.allow_overnight_loops` (`false` = stop at a clean checkpoint); pause to check in if findings repeat, fail to converge, or exceed `hygiene.max_followups_before_checkin` (`> 0`) new follow-ups; respect `bar.protected_files` and safety guards.
53
+ - **Disk, secret, & scratchpad hygiene:** check free disk at `hygiene.disk_check_path` against `hygiene.min_free_disk_gb` (`> 0`) before every review/fix round; pass `--basetemp <session-scratchpad>/<subagent-temp>` and delete temp repo copies/`--basetemp` dirs before reporting; never force-push; verify `git diff --cached --name-only` blocks `git.blocked_staged_globs` (including `.stewardkit.local.toml`).
54
+
55
+ ## Pitfalls
56
+
57
+ - **Fabricated delegation or lead-session edits:** never claim subagent reviews in single-agent mode or make "quick" lead edits when subagents are active.
58
+ - **Duplicating unmanaged rules across harness files:** keep one canonical rules file (`AGENTS.md`) and point other harness files to it.
59
+ - **Skipping coherence checks or overlapping parallel writers:** causes silent clobbers and mutually undoing fixes.
60
+ - **Runaway loops or poor hygiene:** never ignore stalls, non-convergence, overnight limits, blocked staged files, or leftover `--basetemp` dirs.
61
+
62
+ ## Verification
63
+
64
+ 1. Work lives on a dedicated feature branch (not `git.default_branch`).
65
+ 2. Execution matched effective `profile` and `orchestration_mode` cleanly without fabricated delegation.
66
+ 3. Free disk at `hygiene.disk_check_path` meets `hygiene.min_free_disk_gb` (`> 0`).
67
+ 4. Any same-spot choice passes both test sets and is logged under **"Same-spot choices"** in `docs.how_it_works`.
68
+ 5. Zero `git.blocked_staged_globs` are staged, and all temp copies and `--basetemp` dirs are deleted.
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: steward-sweep
3
+ description: >-
4
+ Executes the pre-delivery review sweep: checkpoint commit, diff-scoped frozen
5
+ read-only review, independent triage, all-inclusive class fixes, fresh
6
+ re-reviews, PR or direct-merge delivery, and cleanup. Use before delivering
7
+ any feature, fix, or refactor branch.
8
+ ---
9
+
10
+ # Workflow Review Sweep
11
+
12
+ ## When to use
13
+
14
+ Run before delivering **any** feature, fix, or refactor branch onto `git.default_branch`. Never open a final ready-to-merge PR or merge until a frozen read-only sweep clears with zero open kept findings and zero pending owner calls. Read `.stewardkit.toml` (and valid user/local overrides) first.
15
+ - **Automatic Global Mode (no `.stewardkit.toml`):** Infer the default branch via `origin/HEAD` -> `main`/`master`, skip git branch/merge steps in non-git folders, keep findings/nits in chat (or the external per-repo state dir when `projectless.state_mode = "external"`) without creating repo docs, and run `stewardkit check-tests --doc-readers-only` (works without `docs/tests.md`). Stay silent when `mode = "excluded"`.
16
+
17
+ Related skills: `steward-orchestrate` (orchestration, coherence, hygiene), `steward-intent-bar` (The Bar, nits, `real_cases_only`, parity), `steward-init` (profiles & config).
18
+
19
+ ## Procedure
20
+
21
+ ### 1. Pre-Sweep Gate, Profile Ceremony, & Checkpoint
22
+
23
+ Scale ceremony to `[stewardkit].profile`:
24
+ - **`light`:** streamlined single-pass diff review — skip `docs/findings.md` and `docs/nits/` ceremony, fix Bar issues, verify tests, deliver per `git.delivery_mode` (default `direct-merge`).
25
+ - **`standard`** (default): frozen diff review, triage, class fixes, fresh re-review, `docs.findings` + categorized nits, `pull-request`, opt-in parity.
26
+ - **`strict`:** full subagent review, independent triage, fresh re-reviewers, `stewardkit check-tests` required, `pull-request` (unless overridden).
27
+
28
+ Pre-flight:
29
+ 1. Check free disk at `hygiene.disk_check_path` against `hygiene.min_free_disk_gb` (`> 0`).
30
+ 2. Run tests under `tests.roots` (honoring `tests.ignore_globs`), plus `stewardkit check-tests` when `bar.require_tests_doc_parity = true`.
31
+ 3. **Checkpoint commit & push** (via git specialist when delegating): commit branch changes with zero `git.blocked_staged_globs` staged; check `git remote` and push to `origin` only if configured (never force-push; skip pushes cleanly in local-only repos).
32
+
33
+ ### 2. Frozen Diff-Scoped Read-Only Review
34
+
35
+ 1. **Freeze the working tree:** zero edits (including `docs.findings`/`docs.nits_dir`) and zero commits until the review pass finishes.
36
+ 2. **Scope to `<default_branch>..HEAD` + interaction surface:** inspect `git diff <default_branch>..HEAD` plus directly affected callers, key/schema readers, UI, stored data, config/deploy files, and user-facing docs (`README.md`, `docs.how_it_works`, `docs.tests`). Never do whole-repo re-reads; never inspect `bar.exempt_review_files`.
37
+ 3. **Read-only reviewers:** forbid edits in reviewer subagent briefs (cite exact files/lines in reply/scratchpad), or run an explicit read-only **Reviewer** pass over the committed diff in single-agent mode (prefer a fresh session for high-stakes reviews; never fabricate delegation).
38
+ 4. **Apply The Bar:** report only findings clearing the 7 Bar items (plus real-instance proof when `bar.real_cases_only = true`). Optional out-of-bar notes go under **`Nits (non-blocking)`**.
39
+
40
+ ### 3. Independent Triage
41
+
42
+ After all reviewers finish:
43
+ 1. Assign a domain specialist **distinct from the reviewer** (or run an explicit **Triage** pass in single-agent mode re-verifying every claim against code, tests, and `docs.intent`).
44
+ 2. Classify: **Keep** (valid in-scope); **Open Follow-Up** (valid out-of-scope — log in `docs.findings` unless `light`; check in above `hygiene.max_followups_before_checkin > 0`); **Drop** (fails The Bar/false positive — keep marked **`Dropped`** with reason in `docs.findings`, never delete).
45
+ 3. Update `docs.findings` (Technical Writer; skipped under `light`) once the tree unfreezes.
46
+
47
+ ### 4. All-Inclusive Fix-by-Class Round
48
+
49
+ If kept findings exist:
50
+ 1. **Fix all kept findings together in one round** — never one-by-one. Check repeats first in `docs.findings` and fix the underlying class across the diff.
51
+ 2. **Run coherence check** (`steward-orchestrate`); settle same-spot conflicts upfront and log under **"Same-spot choices"** in `docs.how_it_works`.
52
+ 3. **Write failing unit tests first** for the full failure class under `tests.roots`, fix the class, update `docs.tests` + run `stewardkit check-tests` when parity is enabled.
53
+ 4. **Never punt re-review findings** — fix them in the same round. Commit (push if `git remote` lists `origin`) before re-review.
54
+
55
+ ### 5. Fresh Re-Review & Zero-Change Exit
56
+
57
+ - **Zero-change exit:** 0 code/test lines changed (`bar.exempt_review_files` only) never triggers another sweep.
58
+ - **Fresh re-reviewers:** launch a **fresh** same-specialty reviewer (or fresh session/diff pass in single-agent mode) with the written prior report, triage notes, added tests, and new diff — never rely on prior memory.
59
+ - **Stop condition:** repeat until a frozen review reports **0 new kept findings** (pause on repeats, non-convergence, or overnight limit when `hygiene.allow_overnight_loops = false`).
60
+
61
+ ### 6. Delivery (`git.delivery_mode`) & Final Cleanup
62
+
63
+ Once clean with zero open owner calls:
64
+ 1. **Findings & nits** *(skipped under `light`)*: update `docs.findings` (`docs.timezone`/`docs.clock_format`), log `Nits (non-blocking)` into `<nits_dir>/<category>.md` (when enabled), and commit (push if `origin` exists).
65
+ 2. **Deliver** (via git specialist when delegating):
66
+ - **`pull-request`** (`standard`/`strict` default): check `git remote` — if none, stop and ask whether to add a remote or switch to `direct-merge`. Push `<branch>`, open/update a PR targeting `<default_branch>` noting `git.merge_strategy`, and delete any `wip/<branch>` backup.
67
+ - **`direct-merge`** (`light` default, or configured):
68
+ - `git switch <default_branch>` (and `git pull --ff-only origin <default_branch>` **only if `git remote` lists `origin`**).
69
+ - **`no-ff`:** `git merge --no-ff <branch>` && `git branch -d <branch>`
70
+ - **`ff-only`:** `git merge --ff-only <branch>` && `git branch -d <branch>`
71
+ - **`squash`:** `git merge --squash <branch>` && `git commit -m "<msg>"` && `git branch -D <branch>` (`-d` fails after squash)
72
+ - **Only when `git remote` lists `origin`:** `git push origin <default_branch>` and `git push origin --delete <branch>`.
73
+ 3. **Final cleanup (mandatory):** delete leftover scratchpad copies, temp DBs, `--basetemp`, and `pytest-of-*` dirs (keep shared caches); confirm free disk meets `hygiene.min_free_disk_gb` (`> 0`).
74
+
75
+ ## Pitfalls
76
+
77
+ - **Breaking the freeze or whole-repo re-reads:** never edit during review; scope to `<default_branch>..HEAD` + affected surfaces.
78
+ - **Self-triage, one-by-one fixes, or punting re-review findings:** separate reviewer/triager, fix by class in one round, fix re-review findings immediately.
79
+ - **Re-reviewing exempt-only rounds or reusing stale memory:** 0-code/test-line rounds exit; re-reviews use fresh reviewers with written context.
80
+ - **Broken `squash` merge or unguarded `origin` commands:** `squash` requires explicit `git commit` + `git branch -D`; check `git remote` before pull/push.
81
+ - **Wrong delivery mode or skipped cleanup:** never direct-push under `pull-request`, never force-push/stage blocked files, always clean temps.
82
+
83
+ ## Verification
84
+
85
+ 1. Final frozen review reports **0 new kept findings** and zero open owner calls.
86
+ 2. Tests pass under `tests.roots` (and `stewardkit check-tests` passes when parity is enabled).
87
+ 3. `docs.findings` is updated and committed (unless `light`), with nits only under `<nits_dir>/<category>.md`.
88
+ 4. Delivery matches `git.delivery_mode` and `git.merge_strategy` with `git remote` guards honored and zero force-pushes.
89
+ 5. Scratchpad copies, `--basetemp`, and `pytest-of-*` dirs are deleted and free disk meets `hygiene.min_free_disk_gb` (`> 0`).