<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xml:base="https://docs.spec-kitty.ai/development/reference/quality-and-tech-debt-standing-orders/">
  <id>https://docs.spec-kitty.ai/development/reference/quality-and-tech-debt-standing-orders/</id>
  <title>Quality &amp; Tech-Debt Standing Orders</title>
  <updated>2026-09-30T00:00:00.000Z</updated>
  <author><name>Spec Kitty</name></author>
  <link rel="alternate" type="text/html" href="https://docs.spec-kitty.ai/development/reference/quality-and-tech-debt-standing-orders/"/>
  <summary>Eight-section standing orders for spec-driven missions: adversarial squads, campsite cleaning, test discipline, architectural gates, sources, git workflow, and mission hygiene.</summary>
  <content type="html">&lt;span id=&quot;quality--tech-debt-standing-orders&quot;&gt;&lt;/span&gt;
&lt;blockquote&gt;
&lt;p&gt;The binding text is the charter’s
&lt;a href=&quot;https://github.com/spec-kitty/spec-kitty/blob/main/.kittify/charter/charter.md&quot;&gt;Quality &amp;#x26; Tech-Debt Standing Orders&lt;/a&gt;
section. This page is the explained companion; if the two disagree, the
charter wins.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A working set of standing practices for keeping quality high and paying tech debt
back incrementally, applied across spec-driven missions (spec → plan → tasks →
implement → review → consolidate).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The throughline:&lt;/strong&gt; never trust a green check, a clean diff, or a confident
summary. Verify against live code, witness the bug in a real run, and let
independent adversarial perspectives try to break the work &lt;em&gt;before&lt;/em&gt; it lands —
at the cheapest possible point in the lifecycle.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;1-the-adversarial-squad-cadence-the-spine&quot;&gt;1. The Adversarial Squad Cadence (the spine)&lt;/h2&gt;
&lt;p&gt;Deploy a bounded, profile-loaded adversarial squad at high-leverage review
point-cuts so independent doctrine lenses converge on findings no single
reviewer would catch — this is the single highest-leverage practice: it
reliably catches undersizing (repeatedly observed at 4–5×) and fakeable
acceptance criteria while they are still cheap prose, not code.&lt;/p&gt;
&lt;p&gt;The &lt;code dir=&quot;auto&quot;&gt;adversarial-squad-deployment&lt;/code&gt; procedure is the single owner of when,
who, and how — it names the point-cut list, the casting rule (profiles are
chosen per point-cut question, not by headcount), the model-tier discipline,
and the findings-disposition contract. In one line: at each point-cut, cast
the profiles whose declared focus answers that point-cut’s specific question,
dispatch them in parallel, and fold the confirmed findings back into the
artifact before moving on. See the procedure for the full playbook,
anti-patterns, and casting examples.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Real example: the post-tasks squad on a recent mission found a P0 defect was
&lt;em&gt;already half-fixed by a prior merged PR&lt;/em&gt; (the spec had over-scoped from stale
code-state) and that the gate’s anti-mass-allowlist defense was enforced
nowhere — both fixed before implementation started.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2 id=&quot;2-campsite-cleaning--incremental-debt-paydown&quot;&gt;2. Campsite Cleaning &amp;#x26; Incremental Debt Paydown&lt;/h2&gt;
&lt;p&gt;Leave the campsite cleaner than you found it — &lt;strong&gt;without inflating scope&lt;/strong&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Domain-matched folds only.&lt;/strong&gt; At each planning point, check whether any part
of the standing tech-debt backlog can be folded into &lt;em&gt;this&lt;/em&gt; mission — but only
when the debt’s domain matches the mission’s intended scope. A test-hygiene
ratchet adjacent to files the mission already opens: fold it. An unrelated
sweep: leave it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Consolidate logical duplication.&lt;/strong&gt; When a bug cluster is really &lt;em&gt;one
operation duplicated across N sites&lt;/em&gt;, fix it by collapsing to &lt;strong&gt;one canonical
seam&lt;/strong&gt; (compose-and-parse, canonical-first, emit-don’t-guess, plus a
literal-ban ratchet) rather than N parallel patches. Run a patterns lens early
— spec and plan almost always undersize this.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Frozen-baseline ratchets.&lt;/strong&gt; When you can’t remediate an existing litter
class in-mission, freeze the current offenders as a baseline and block &lt;em&gt;new&lt;/em&gt;
ones — debt stops growing while you chip at it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tracker hygiene.&lt;/strong&gt; Meta/convenience rollups reference work via checklist;
they are never the canonical parent of a functional ticket. Park work under
functional epics.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&quot;3-mission-tracer-files&quot;&gt;3. Mission Tracer Files&lt;/h2&gt;
&lt;p&gt;Seed three small &lt;strong&gt;tracer files&lt;/strong&gt; at planning, append to them during
implementation, and assess them at mission close:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Tooling-friction&lt;/strong&gt; — every place the tooling fought you (feeds the
tooling-gap backlog).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Approach&lt;/strong&gt; — what you tried, what worked, what you’d do differently.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Design decisions&lt;/strong&gt; — the rationale that would otherwise evaporate.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Why: the friction and rationale captured here feed the &lt;em&gt;next&lt;/em&gt; mission’s planning
and make recurring tool/process gaps visible instead of re-discovered.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;4-test-remediation--bug-fix-discipline&quot;&gt;4. Test Remediation &amp;#x26; Bug-Fix Discipline&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Judge the test, not git-blame.&lt;/strong&gt; A failing test is one of four things:
&lt;em&gt;stale assertion&lt;/em&gt; (same valid scenario, outdated expected value) → re-pin it;
&lt;em&gt;a stub/scaffold&lt;/em&gt; → delete it; &lt;em&gt;encodes a superseded product direction/design&lt;/em&gt;
→ &lt;strong&gt;remove it outright&lt;/strong&gt; (see next bullet); &lt;em&gt;valid and current&lt;/em&gt; → the
&lt;strong&gt;product&lt;/strong&gt; is wrong, fix the product. Never retry-to-green; never soften a
good test to make a build pass.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;When a test no longer represents the desired design, delete it — do not
teach the product to serve the dead usage.&lt;/strong&gt; This is the sharp edge of “fix
the test, not the code.” If a test’s very &lt;em&gt;premise&lt;/em&gt; — its setup, the flow it
drives — exercises a pattern the product has intentionally retired, the test
is not re-pinnable: its whole scenario is dead, so removing it is the correct
remediation. Adding a non-canonical fallback branch to the product so the old
test still passes is a &lt;strong&gt;regression&lt;/strong&gt;: it resurrects the dead path and
violates canonical-source discipline (§6). Worked example (#2773): after the
&lt;code dir=&quot;auto&quot;&gt;charter.yaml&lt;/code&gt; authority inversion, &lt;code dir=&quot;auto&quot;&gt;charter synthesize&lt;/code&gt; requires the
canonical &lt;code dir=&quot;auto&quot;&gt;charter.yaml&lt;/code&gt;; tests that seeded a &lt;code dir=&quot;auto&quot;&gt;charter.md&lt;/code&gt;-only project and
asserted success were driving the retired pre-inversion flow — the fix was to
&lt;strong&gt;delete&lt;/strong&gt; them, not to re-add a &lt;code dir=&quot;auto&quot;&gt;charter.md&lt;/code&gt; gate to the resolver. Guard
rails: this is distinct from a &lt;em&gt;stale assertion&lt;/em&gt; (keep the test, re-pin the
value) and, crucially, from &lt;em&gt;deleting a good test to dodge a real product
failure&lt;/em&gt; — the latter is forbidden (§7). The test on your bench: “Does the
desired product design still want this behavior to exist at all?” If no →
remove. If yes, but the expected value moved → re-pin. If yes, and the product
now does the wrong thing → fix the product.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Red-first reproduction.&lt;/strong&gt; Write the RED test &lt;strong&gt;first&lt;/strong&gt;, through the
&lt;strong&gt;pre-existing&lt;/strong&gt; entry point (not the fix’s brand-new API), and prove it red
against pre-fix code. A test that’s green before &lt;em&gt;and&lt;/em&gt; after the fix captures
nothing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Live evidence over static-fixed.&lt;/strong&gt; A bug witnessed in a real run is &lt;em&gt;not&lt;/em&gt;
fixed because the code now “looks fixed.” Carry it OPEN until a live
reproduction confirms the fix.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tests are friction, not scaffold.&lt;/strong&gt; A degraded suite silently reverts good
changes and wastes effort. When a correct structural change turns a test red,
suspect the test before reverting the change.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Realistic test data.&lt;/strong&gt; Production-shaped (real-format IDs, realistic
lengths). Handcrafted placeholders mask real behavior.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&quot;5-architectural-gate-discipline&quot;&gt;5. Architectural Gate Discipline&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Close defect classes by construction.&lt;/strong&gt; When a defect class is “a convention
every caller must remember,” don’t add more discipline — add an architectural
&lt;strong&gt;call-site gate&lt;/strong&gt; (e.g. AST-based) that makes the omission a CI failure.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Make the gate non-vacuous.&lt;/strong&gt; Every gate needs a &lt;strong&gt;concrete floor&lt;/strong&gt; (a real
integer, never self-referential) and a &lt;strong&gt;self-mutation test&lt;/strong&gt; (inject a
violation → gate fails → revert → passes) so it cannot silently become a
no-op. Allowlists are &lt;strong&gt;shrink-only&lt;/strong&gt; against a frozen pre-sweep baseline, and
each allowlisted exception carries a recorded rationale.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A “route-or-allowlist” gate needs a routed-count floor.&lt;/strong&gt; Otherwise it is
vacuously satisfiable by allowlisting everything.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A gate-unmask cannot self-validate.&lt;/strong&gt; Un-masking a gate only takes effect
&lt;em&gt;after&lt;/em&gt; the merge, so it cannot catch offenders within its own merge. Pair
every un-mask with a &lt;strong&gt;pre-merge full-gate dry-run&lt;/strong&gt;; never ship a
mission-diff-scoped assertion to the main branch.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Post-consolidation arch-gate adjudication.&lt;/strong&gt; On the consolidated branch,
before opening the PR, run the specific &lt;code dir=&quot;auto&quot;&gt;tests/architectural/&lt;/code&gt; gate files the
change implicates — not the whole directory (&lt;a href=&quot;https://github.com/spec-kitty/spec-kitty-open-packs/blob/main/packs/internal/directives/no-full-heavy-suites-in-mission.directive.yaml&quot;&gt;&lt;code dir=&quot;auto&quot;&gt;NO_FULL_HEAVY_SUITES_IN_MISSION&lt;/code&gt;&lt;/a&gt;; CI’s cross-cutting lane
runs the full sweep). Verify any “pre-existing” failure via a &lt;strong&gt;cross-base
diff&lt;/strong&gt; (the lane base is not the mission base).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keep the new code clean.&lt;/strong&gt; Lint/type checks pass on new and boy-scout-touched
code; fix failing tests rather than rationalizing them.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&quot;6-canonical-sources--unification&quot;&gt;6. Canonical Sources &amp;#x26; Unification&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Use canonical sources, never improvise.&lt;/strong&gt; Always use the canonical doctrine
templates, skills, and CLI commands — never copy structure from an older
mission or hand-roll an equivalent. Drift propagates.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unification, not parity.&lt;/strong&gt; Chase one canonical surface/authority; don’t
preserve a lacklustre existing quirk for “parity.” The old quirk is mess to
remove — with the caveat that you don’t drop a load-bearing invariant you
haven’t proven is dead.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A missing CLI command is a gap, not a workaround.&lt;/strong&gt; If a documented command
is absent or broken, trace the source and file an upstream gap rather than
silently routing around it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Guard the terminology canon.&lt;/strong&gt; Run the terminology guard before pushing
doctrine or user-facing prose; forbidden terms get reworded, not exempted.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&quot;7-git--workflow-discipline&quot;&gt;7. Git &amp;#x26; Workflow Discipline&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;PRs only; the operator merges.&lt;/strong&gt; All changes to the protected main branch go
through pull requests. The operator merges manually — agents prepare
merge-ready (green CI, un-drafted, issues linked) and hand off; they never
merge to the remote main themselves.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Read intent before high-risk ops.&lt;/strong&gt; Read the mission spec/intent &lt;em&gt;before&lt;/em&gt;
any merge, rebase, or deletion. Never delete a test to make a build pass.
Escalate when unsure — correctness over speed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Isolate PR-touching agents.&lt;/strong&gt; Any agent that reviews or rebases a PR runs in
an &lt;strong&gt;isolated worktree&lt;/strong&gt; — otherwise it stages the PR’s diff into the active
mission checkout and cross-contaminates.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Compress history after landing.&lt;/strong&gt; Once a mission lands, compress its branch
history (administrative commits bunched, code grouped by slice).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No version prescription in scope.&lt;/strong&gt; Don’t assign patch/version numbers during
planning — versions are superimposed at release time.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&quot;8-mission-hygiene&quot;&gt;8. Mission Hygiene&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Issue-matrix discipline.&lt;/strong&gt; For ticket-based missions, every addressed issue
gets an issue-matrix row, a claim, and a tracker comment naming the mission.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ownership-map leeway.&lt;/strong&gt; Give implementers rationale-backed leeway to edit
outside their declared owned-files; the &lt;em&gt;no-overlap&lt;/em&gt; rule between work packages
is the real guard against parallel collisions, not a strict prohibition (strict
prohibition just causes workarounds).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Role separation.&lt;/strong&gt; Distinct profiles for distinct roles — a dedicated
reviewer profile for work-package reviews, kept separate from the implementer
profile.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tiered rigour.&lt;/strong&gt; Apply DDD-tiered coding standards — more rigour for core
domain logic, less for glue/IO — encoded in doctrine, CI, and the effort a
delegated agent spends.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&quot;in-one-sentence&quot;&gt;In one sentence&lt;/h2&gt;
&lt;p&gt;Wrap every planning and execution boundary in a bounded, profile-loaded
adversarial pass; fold in only domain-matched debt; prove fixes red-first and
with live evidence; and close defect classes with non-vacuous, self-testing
gates rather than with discipline alone.&lt;/p&gt;</content>
</entry>
