# Enforcement Boundary and Task Schema Hardening - 2026-07-19

**Register:** `surface`  
**Audience:** internal operators, GAIA, APOLLO, DEMETER, POSEIDON, future forward engineers  
**Status:** Complete

## Why this pass happened

Two separate enforcement problems surfaced in live use:

1. **The offer lane was too broad.**  
   The `OFFER-VIABILITY-GATE` was misclassifying a financial reconciliation report as a sales offer because the gate still treated some report-like commercial files as offer candidates.

2. **The task discipline layer was too weak at the live-board level.**  
   POSEIDON's live task base carried real history, but many tasks still lacked explicit operating-schema structure. The task board was therefore usable to humans who knew the context, but not yet clean enough for system enforcement or handoff-grade machine reads.

3. **The code standards boundary was pointed at the wrong filesystem.**  
   `CODE-STANDARDS-GATE` was still scanning `C:\laragon\www\...`, so a Phepisa client build file (`public-footer.tsx`) was being judged by Kujenga11 Systems-layer standards. That was a boundary mistake, not a code-quality insight.

This pass corrected all three.

---

## What changed

### 1. OFFER-VIABILITY-GATE narrowed to real offer artifacts

**Files touched**
- `.CLAUDE/hooks/offer-viability-gate.js`
- `KAE/test/offer-viability-gate.test.js`

**What was added**
- path exclusions for non-offer contexts such as `Reports/`
- content exclusions for reconciliation/accounting-style documents
- exemption marker handling for known non-offer files

**Practical result**
- finance and reconciliation reports stop generating false commercial warnings
- the offer lane now focuses on actual service / offer definition artifacts

---

### 2. POSEIDON task schema moved from partial discipline to full live-board discipline

**Files touched**
- `Systems/Guardian/POSEIDON/tasks.json`
- `Systems/Guardian/POSEIDON/Data/task-schema-audit-2026-07-19.md`
- `Systems/Guardian/POSEIDON/Data/task-schema-audit-2026-07-19.json`
- `Systems/Library/OGUN/Tools/Scripts/task-schema-audit/task-schema-audit.js`
- `Systems/Library/OGUN/Tools/Scripts/task-schema-audit/task-schema-backfill.js`
- `Systems/Library/OGUN/Tools/Registry/00-registry.md`

**What was built**
- a **non-mutating audit tool** that measures which live tasks still fail the operating schema
- a **curated backfill tool** that safely writes explicit schema fields onto known live tasks instead of hand-editing brittle note history

**Schema fields normalized**
- `job`
- `action_plan`
- `resources`
- `validation`
- `rules`

**Practical result**
- POSEIDON moved from:
  - `50` live tasks audited
  - `50` live tasks with gaps
- to:
  - `50` live tasks audited
  - `0` live tasks with gaps

This means the live board is now structurally readable by both humans and enforcement logic without depending on unstated session memory.

---

### 3. CODE-STANDARDS-GATE was restricted back to the repo boundary

**Files touched**
- `.CLAUDE/hooks/code-standards-gate.js`
- `KAE/test/code-standards-gate.test.js`
- `KAE/state/code-standards-gate-violations.json`

**What changed**
- removed the Laragon root resolution path
- gate now checks only files inside the Kujenga11 repo
- stale Laragon violation state was cleared
- a regression test now proves:
  - repo files are still checked
  - Laragon client files are ignored

**Practical result**
- Systems-layer enforcement is no longer polluting client-app implementation lanes
- false positives from `C:\laragon\www\` stop consuming attention and state-file noise

---

## Why this matters architecturally

This was not just a bug-fix session. It clarified three different enforcement truths:

1. **A gate must know its jurisdiction.**  
   If a rule does not know which filesystem, artifact family, or business layer it owns, it will generate noise instead of control.

2. **Live task boards need explicit structure, not only human-readable history.**  
   Notes are memory. Schema fields are operations. The OS needs both.

3. **Curated mutators are safer than brittle hand edits on large canonical files.**  
   `tasks.json` had reached the point where repeated manual patching was riskier than building a narrow-purpose cleanup tool.

---

## Reusable patterns extracted

### Pattern A - Repo-bound enforcement only
If a hook is part of the Kujenga11 control plane, its default scope should be the repo unless there is an explicit doctrine reason to reach outside it.

### Pattern B - Audit first, mutate second
When a canonical file has rich history and weak structure:
1. audit the gaps
2. write a narrow backfill tool
3. re-audit to verify the change

### Pattern C - Notes are not enough
If a gate expects machine-readable structure, write explicit object fields. Do not assume note blobs are a stable system interface.

---

## Verification completed

### Task discipline
```bash
node Systems/Library/OGUN/Tools/Scripts/task-schema-audit/task-schema-backfill.js
node Systems/Library/OGUN/Tools/Scripts/task-schema-audit/task-schema-audit.js
```

### Hook tests
```bash
node --test KAE/test/offer-viability-gate.test.js
node --test KAE/test/campaign-quality-gate.test.js
node --test KAE/test/tasks-data-gate.test.js
node --test KAE/test/project-gate.test.js
node --test KAE/test/code-standards-gate.test.js
```

All targeted tests passed.

---

## What to watch next

1. Keep new enforcement hooks scoped to the control plane they actually own.  
   The Laragon false positive showed that boundary drift creates fake work.

2. Reuse the task backfill tool instead of editing `tasks.json` by hand when another large schema migration happens.

3. If another gate starts misfiring on an external build tree, fix the ownership boundary first before tuning its content heuristics.

---

## Related files

- `Systems/Guardian/GAIA/Instructions/05-operating-schema.md`
- `Systems/Guardian/POSEIDON/Data/task-schema-audit-2026-07-19.md`
- `Systems/Library/OGUN/Tools/Scripts/task-schema-audit/task-schema-audit.js`
- `Systems/Library/OGUN/Tools/Scripts/task-schema-audit/task-schema-backfill.js`
- `.CLAUDE/hooks/offer-viability-gate.js`
- `.CLAUDE/hooks/code-standards-gate.js`
