Rule
Work only in worktrees, treat main as read-only, never run destructive git commands on main.
The Constraints Capsule contains eleven non-negotiable rules that every agent and developer using the Software Delivery Pack must follow. These rules are designed to prevent common mistakes and ensure consistent, safe workflow execution.
LumenFlow is designed to give AI agents and developers autonomy. But autonomy without guardrails leads to chaos. Constraints provide:
Rule
Work only in worktrees, treat main as read-only, never run destructive git commands on main.
Enforcement:
pnpm wu:claim, immediately cd into the worktree it createdgit reset --hard, git stash, git clean -fd, git push --forceWhy: Worktree isolation prevents cross-contamination between parallel WUs and protects the main branch from accidental damage.
Example:
Rule
Respect code_paths boundaries, no feature creep, no code blocks in WU YAML files.
Enforcement:
code_pathsWhy: WUs define WHAT to build, not HOW. Implementation decisions belong in code, not specs. This keeps specs clean and prevents scope creep.
Example:
Rule
Documentation WUs use --docs-only gates, code WUs run full gates.
Enforcement:
type: documentation in WU YAML triggers docs-only modepnpm gates --docs-only skips lint/typecheck/testsWhy: Documentation changes shouldn’t require the full test suite. Code changes must pass all gates. Mixing them causes friction.
Example:
Rule
Use LLMs for semantic tasks, fall back to safe defaults (never regex/keywords).
Enforcement:
Why: Regex and keyword matching are brittle and fail on edge cases. LLMs handle natural language variation better. When the LLM fails, use safe defaults - never fall back to keyword hacks.
Example:
Rule
Complete via pnpm wu:prep (gates) then pnpm wu:done; only explicitly named skippable gates can
be skipped, with --reason and --fix-wu.
Enforcement:
pnpm wu:prep runs gates in the worktree--skip-gates binary is removed and always rejected--skip-gate <name> requests require both --reason and --fix-wuformat:check, lint, typecheck, co-change, spec:linter, claim-validation,
unread-directed-signal, invariants, and safety-critical-test are immutable;
configuration rejects skippable: true for these gatesapplicability_paths can narrow only format:check, lint, typecheck,
co-change, spec:linter, and safety-critical-test. claim-validation and
invariants remain always-on; unread-signal exceptions use the audited
--allow-unread-signals --reason flow after signal triageformat:check, lint, typecheck, or spec:linter scripts block in
default modeWhy: Gates ensure quality. Skipping requires accountability and a plan to fix the underlying issue. Without this, quality degrades over time.
Example:
Only skip when ALL are true:
Rule
Respect privacy rules, approved sources, security policies; when uncertain, choose the safer path.
Enforcement:
Enable scanning through the validated workspace configuration:
Supply a native Gitleaks executable on PATH separately
(version 8.19 or newer, with the git command). LumenFlow does not download it or enable the
policy automatically. Install the updated managed hook through the normal init, enable or upgrade
workflow. A source change alone does not update an existing consumer installation.
When enabled, the hook scans historical file diffs for every published non-deletion ref before the
tmp/* lifecycle exemption. Updates exclude only that ref’s advertised remote commit; new branches
and tags scan their complete reachable local history, including root commits and merge changes.
This can report an older credential even when the current tree is clean. Alternate remotes and the
configured integration target do not narrow this scope. Annotated tags must resolve to a commit.
Shallow history, unavailable objects, malformed input, findings, missing executables, scanner errors,
timeout and output overflow refuse the push with safe diagnostics. Fix the published history and
rotate exposed credentials; use your scanner’s own local tools to investigate a refusal.
The total scan deadline defaults to 30 seconds and accepts 1–300000 milliseconds, shared by Git
validation and all refs. Scope is bounded to 128 ref updates and 1 MiB of stdin; each subprocess has
64 KiB of combined captured output, followed by at most five seconds of forced cleanup. Scanner
output is discarded, including on errors. No report or credential content is written by LumenFlow.
The scanner runs locally using its normal rules/configuration; existing Gitleaks configuration or
allowlists can affect detection. LumenFlow does not add or change those rules or ignores. Its Gitleaks
git command receives the repository root as a positional operand.
The Linux fixture has been exercised with real Gitleaks 8.30.1 through the generated pre-push hook and built checker under a fixture-only licence: a clean push to a local bare remote passed, while a synthetic finding was refused and left the remote ref unchanged. This is a local compatibility check, not production package closure, a customer licence grant, public release or deployment validation, macOS or Windows certification, or a guarantee that every credential will be detected. The release archive SHA-256 matched its downloaded publisher checksum manifest before extraction; the executable SHA-256 is a local fingerprint only. No signed-certificate provenance is claimed.
Historical diff scanning does not scan commit or tag messages, every Git object, binary/archive or submodule repository content, uncommitted files, or files omitted by the engine’s rules. It cannot guarantee detection of every credential. Bypassed or modified hooks and other publication paths provide no local scan guarantee. Git operations disable lazy object fetching and replacement refs for the scan; use Git 2.45 or newer for the local-only missing-object guard. A dependency-free temporary worktree uses the primary checkout’s existing installed CLI while reading both policy and history from the original temporary root.
Why: Safety first. Some mistakes are irreversible. When in doubt, stop and ask rather than proceed and regret.
Stop and ask when:
| Trigger | Action |
|---|---|
| Same error 3 times | Stop, ask |
| Auth/permission changes | Stop, ask |
| PII/secrets involved | Stop, ask |
| Cloud spend decisions | Stop, ask |
| Policy changes needed | Stop, ask |
Rule
NEW test failures block gates; pre-existing failures (already in the baseline) warn but do not block.
Enforcement:
pnpm test:baseline:init creates the baseline from the current failing test setpnpm test:baseline:update refreshes the baseline after an intentional ratchet changeWhy: Agents should not be blocked by unrelated, pre-existing failures. The ratchet ensures quality only improves over time — failures can be removed from the baseline, but never silently added without justification.
Rule
Evaluate lane fitness during WU and initiative scoping, and propose a lane change when a WU’s scope no longer fits its lane’s boundaries.
Enforcement:
code_paths align with the claimed lane’s code_paths in workspace.yamlpnpm lane:suggest --paths "..." to get lane recommendations for ambiguous scopingWhy: Lane boundaries define ownership, WIP limits, and parallel execution safety. Misassigned WUs undermine these guarantees and create coordination confusion.
Rule
Never use raw Write/Edit tools to modify workspace.yaml or WU YAML specification files — always
use the dedicated CLI commands.
Enforcement:
workspace.yaml → pnpm config:set (write) / pnpm config:get (read)pnpm wu:edit (modify) / pnpm wu:create (create)Why: CLI tooling provides schema validation, atomic commits, an audit trail, and automatic type coercion. Raw edits bypass all of these safeguards and can produce invalid configuration that breaks downstream commands.
Rule
If the same operation fails three times, stop retrying and escalate to the user with a summary of what failed and why.
Enforcement:
wu:create, wu:claim, wu:done, gates, etc.), git operations, build/install steps, and any repeated validation failureWhy: Retry loops waste user time and context window. Three failures usually means the agent has the wrong mental model of the problem — escalating early lets the user correct course before additional mess accumulates.
Rule
When writing or updating content shown to external stakeholders, do not treat internal docs as ground truth for factual claims — flag specific claims to the user for verification.
Enforcement:
Why: Internal docs go stale. The user always knows what’s current; an agent confidently restating a stale internal fact in client-facing material undermines trust in both the material and the agent.
Before running wu:done, verify:
code_pathspnpm gates or pnpm gates --docs-only)These commands are blocked on main checkout:
Allowed in worktrees: Most commands are safe in isolated worktrees on lane branches. The restrictions apply specifically to the main checkout.
Why: Force bypass mechanisms circumvent all git hook protections. While legitimate for emergency human interventions, agents using them autonomously undermines the entire workflow enforcement model.
Agent Escalation Path:
Legitimate bypass scenarios:
Never bypass for:
Stop and ask a human when:
When approaching context limits (high token usage, 50+ tool calls), spawn a fresh agent instead of continuing after compaction.
Why: Context compaction causes agents to lose critical rules. Starting fresh ensures constraints remain in working memory.