@aegis-scan/skills 0.2.0 → 0.4.0

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.
Files changed (45) hide show
  1. package/ATTRIBUTION.md +60 -4
  2. package/CHANGELOG.md +78 -0
  3. package/README.md +27 -0
  4. package/dist/bin.js +1 -1
  5. package/dist/commands/list.d.ts.map +1 -1
  6. package/dist/commands/list.js +9 -2
  7. package/dist/commands/list.js.map +1 -1
  8. package/dist/skills-loader.d.ts +43 -0
  9. package/dist/skills-loader.d.ts.map +1 -1
  10. package/dist/skills-loader.js +102 -0
  11. package/dist/skills-loader.js.map +1 -1
  12. package/package.json +1 -1
  13. package/sbom.cdx.json +1 -1
  14. package/skills/compliance/_INDEX.md +49 -0
  15. package/skills/compliance/aegis-native/brutaler-anwalt/SKILL.md +100 -3
  16. package/skills/defensive/aegis-native/rls-defense/SKILL.md +25 -0
  17. package/skills/defensive/aegis-native/tenant-isolation-defense/SKILL.md +26 -0
  18. package/skills/foundation/_INDEX.md +73 -0
  19. package/skills/foundation/aegis-native/aegis-audit/SKILL.md +194 -0
  20. package/skills/foundation/aegis-native/aegis-audit/references/layer-1-headers.md +138 -0
  21. package/skills/foundation/aegis-native/aegis-audit/references/layer-2-html.md +153 -0
  22. package/skills/foundation/aegis-native/aegis-audit/references/layer-3-impressum.md +159 -0
  23. package/skills/foundation/aegis-native/aegis-audit/references/layer-4-dse.md +178 -0
  24. package/skills/foundation/aegis-native/aegis-audit/references/layer-5-cookie.md +180 -0
  25. package/skills/foundation/aegis-native/aegis-audit/references/layer-6-branche.md +204 -0
  26. package/skills/foundation/aegis-native/aegis-audit/references/layer-7-code-cross-check.md +212 -0
  27. package/skills/foundation/aegis-native/aegis-audit/references/layer-8-schadens-diagnose.md +232 -0
  28. package/skills/foundation/aegis-native/aegis-customer-build/SKILL.md +232 -0
  29. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-1-recon.md +147 -0
  30. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-2-architecture.md +164 -0
  31. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-3-component-build.md +231 -0
  32. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-4-content.md +196 -0
  33. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-5-integration.md +273 -0
  34. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-6-mid-audit.md +200 -0
  35. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-7-final-verify.md +258 -0
  36. package/skills/foundation/aegis-native/aegis-handover-writer/SKILL.md +128 -0
  37. package/skills/foundation/aegis-native/aegis-module-builder/SKILL.md +251 -0
  38. package/skills/foundation/aegis-native/aegis-orchestrator/SKILL.md +146 -0
  39. package/skills/foundation/aegis-native/aegis-quality-gates/SKILL.md +122 -0
  40. package/skills/foundation/aegis-native/aegis-skill-creator/SKILL.md +223 -0
  41. package/skills/foundation/aegis-native/aegis-skill-creator/references/hard-constraint-template.md +213 -0
  42. package/skills/foundation/aegis-native/aegis-skill-creator/references/skillforge-methodology.md +220 -0
  43. package/skills/foundation/aegis-native/dsgvo-compliance/SKILL.md +185 -0
  44. package/skills/foundation/aegis-native/dsgvo-compliance/references/art-13-15-templates.md +309 -0
  45. package/skills/foundation/aegis-native/dsgvo-compliance/references/datenpanne-runbook.md +291 -0
@@ -0,0 +1,200 @@
1
+ # Phase 6 Reference — Mid-Audit (AEGIS-Scan + Anwalt Spot-Check + Repair Loop)
2
+
3
+ Phase 6 is MANDATORY. It catches regressions early — before Phase 7 has to find them in a fully-built artifact (which is more expensive to repair). **Time budget:** 20-30 min, plus repair iterations if any gates are red.
4
+
5
+ **Subagent dispatch:** optional. If used, dispatch one Auditor-subagent (model: opus) to run the audits in parallel with Phase 5's tail-end integrations.
6
+
7
+ ---
8
+
9
+ ## Mid-Audit Scope
10
+
11
+ Phase 6 runs a SUBSET of the final-verify gates — the cheap ones that catch most regressions:
12
+
13
+ | Gate | Mid-audit threshold | Final-verify threshold |
14
+ |---|---|---|
15
+ | build | exit 0 | exit 0 |
16
+ | tsc | 0 errors | 0 errors |
17
+ | lint | 0 errors | 0 errors |
18
+ | tests | 100% pass | 100% pass |
19
+ | aegis-scan | score ≥ 900 | score ≥ 950 |
20
+ | brutaler-anwalt (HUNT mode, topic-scoped) | 0 KRITISCH | 0 KRITISCH, ≤ 2 HOCH |
21
+ | Lighthouse | _(skipped — too slow for mid)_ | mobile ≥ 75, desktop ≥ 90 |
22
+ | skillforge-validate | _(N/A unless skills touched)_ | 16/17+ per touched skill |
23
+ | briefing-coverage | _(skipped — pages still being filled)_ | 100% |
24
+
25
+ **Rationale:** the cheap gates (build/tsc/lint/tests/aegis-scan + scoped anwalt) catch ≥ 80% of regressions. Lighthouse + briefing-coverage are deferred to Phase 7 because they require a fully-built artifact.
26
+
27
+ ---
28
+
29
+ ## AEGIS-Scan Invocation Pattern
30
+
31
+ Mid-audit AEGIS-scan runs against the local dev-build:
32
+
33
+ ```bash
34
+ # Build first (or run dev-server)
35
+ cd customers/<slug>
36
+ pnpm run build
37
+ pnpm run start & # or: pnpm dev
38
+ SERVER_PID=$!
39
+
40
+ # Wait for server-ready (max 30s)
41
+ until curl -sf http://localhost:3000 > /dev/null; do sleep 1; done
42
+
43
+ # Run scan
44
+ npx -y @aegis-scan/cli scan http://localhost:3000 \
45
+ --output ./audits/mid-audit-aegis.json \
46
+ --format json
47
+
48
+ kill $SERVER_PID
49
+ ```
50
+
51
+ Parse the JSON:
52
+
53
+ ```ts
54
+ const result = JSON.parse(readFileSync('./audits/mid-audit-aegis.json'));
55
+ if (result.score < 900 || result.grade === 'F') {
56
+ // RED — repair-attempt loop
57
+ }
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Brutaler-Anwalt HUNT-Mode Pattern
63
+
64
+ Mid-audit anwalt run is SCOPED — focuses on the most regression-prone topics, not the full 8-layer audit:
65
+
66
+ ```
67
+ Invoke: compliance/aegis-native/brutaler-anwalt skill in HUNT mode
68
+ Topics: impressum + cookie + dse (the bug-prone surface)
69
+ Target: http://localhost:3000
70
+ Output: customers/<slug>/audits/mid-audit-anwalt.md
71
+ Format: 4-section (Schadens-Diagnose / Findings / Anwalts-Anhang / Abmahn-Simulation)
72
+ ```
73
+
74
+ **Skill-invocation pattern** (Claude Code):
75
+
76
+ ```
77
+ Skill: compliance/aegis-native/brutaler-anwalt
78
+ Args: --mode=hunt --topics=impressum,cookie,dse --target=http://localhost:3000
79
+ ```
80
+
81
+ Or via CLI:
82
+
83
+ ```bash
84
+ npx -y @aegis-scan/skills run compliance/brutaler-anwalt \
85
+ --mode=hunt \
86
+ --topics=impressum,cookie,dse \
87
+ --target=http://localhost:3000 \
88
+ --output=./audits/mid-audit-anwalt.md
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Repair-Attempt Loop
94
+
95
+ If any gate is red, enter repair-attempt loop:
96
+
97
+ ```
98
+ attempts=0
99
+ while [ $attempts -lt 3 ]; do
100
+ attempts=$((attempts+1))
101
+
102
+ # Identify failing gates
103
+ failing=$(jq -r '.gates_failed[]' .aegis/state.json)
104
+
105
+ # For each failing gate:
106
+ for gate in $failing; do
107
+ case $gate in
108
+ tsc) repair_tsc_errors ;;
109
+ lint) repair_lint_errors ;;
110
+ tests) repair_test_failures ;;
111
+ aegis-scan) repair_aegis_findings ;;
112
+ anwalt) repair_anwalt_findings ;;
113
+ esac
114
+ done
115
+
116
+ # Re-run mid-audit
117
+ re_run_mid_audit
118
+
119
+ # Check if all gates green now
120
+ if all_gates_green; then
121
+ break
122
+ fi
123
+ done
124
+
125
+ if [ $attempts -ge 3 ] && ! all_gates_green; then
126
+ echo "Mid-audit INCOMPLETE after 3 repair-attempts"
127
+ echo "Open: $(jq -r '.gates_failed[]' .aegis/state.json)"
128
+ # escalate to Phase 7 with explicit INCOMPLETE-Status
129
+ fi
130
+ ```
131
+
132
+ **Repair-action mapping:**
133
+
134
+ | Failing gate | Common cause | Repair-action |
135
+ |---|---|---|
136
+ | tsc | Missing prop type, undefined import | Find file, add type annotation |
137
+ | lint | Unused var, missing dep | Auto-fix via `pnpm run lint --fix` |
138
+ | tests | New code lacks test, broken existing test | Either write missing test or fix code |
139
+ | aegis-scan: T1 (DNS) | Missing DNSSEC / CAA | Operator-action (DNS-level) — report as DEFER |
140
+ | aegis-scan: T1 (HTTP-headers) | Missing CSP / HSTS / X-Frame | Add to next.config.js or middleware |
141
+ | aegis-scan: T2 (HTML) | Missing alt-text / heading-hierarchy | Edit page.tsx |
142
+ | aegis-scan: T3 (Impressum) | Footer-link missing / 404 | Fix footer-link |
143
+ | anwalt KRITISCH (Impressum) | DDG §5 fields missing | Add to /impressum page |
144
+ | anwalt KRITISCH (Cookie) | Pre-consent tracker | Move tracker behind cookie-banner |
145
+ | anwalt KRITISCH (DSE) | Missing Art. 13 fields | Update /datenschutz page |
146
+
147
+ ---
148
+
149
+ ## State.json Update per Repair-Attempt
150
+
151
+ ```json
152
+ {
153
+ "phase": 6,
154
+ "status": "in-repair",
155
+ "attempts": 2,
156
+ "max_attempts": 3,
157
+ "mid_audit_score": 887,
158
+ "mid_audit_grade": "B+",
159
+ "gates_failed": ["aegis-scan:t1-headers", "anwalt:cookie-banner-pre-checked"],
160
+ "repairs_applied": [
161
+ {"gate": "tsc:missing-import", "fix": "add 'import { Hero }' in app/page.tsx", "result": "passed"},
162
+ {"gate": "anwalt:impressum-missing-vat-id", "fix": "added VAT-ID to footer", "result": "passed"}
163
+ ],
164
+ "next_action": "repair-attempt-3"
165
+ }
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Phase 6 Completion Criteria
171
+
172
+ Mid-audit is complete when EITHER:
173
+
174
+ - All mid-audit gates green (proceed to Phase 7)
175
+ - 3 repair-attempts exhausted with red gates remaining (proceed to Phase 7 with INCOMPLETE-Status flagged)
176
+
177
+ NEVER proceed to Phase 7 without writing the mid-audit checkpoint:
178
+
179
+ ```json
180
+ {
181
+ "phase": 6,
182
+ "status": "complete-green" | "complete-incomplete",
183
+ "mid_audit_score": <N>,
184
+ "mid_audit_grade": "<G>",
185
+ "anwalt_findings": {"kritisch": <N>, "hoch": <N>, "mittel": <N>},
186
+ "open_after_repair": [<list>]
187
+ }
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Anti-Patterns specific to Phase 6
193
+
194
+ - ❌ Skipping mid-audit "to save time" — Phase 6 catches > 80% of regressions cheaper than Phase 7 would.
195
+ - ❌ Running full 9-gate sweep in mid-audit — too slow; mid-audit is a subset.
196
+ - ❌ Looping repair-attempts beyond 3 — diminishing returns; escalate to Phase 7 with INCOMPLETE.
197
+ - ❌ Marking phase 6 complete without writing the checkpoint — next agent (or Phase 7 itself) loses context.
198
+ - ❌ Repairing only the first failing gate and re-running — repair all failing gates per attempt, then re-run once.
199
+ - ❌ Inferring repair-actions from chat-context — read the gate-output (JSON for aegis-scan, MD for anwalt), don't guess.
200
+ - ❌ Ignoring brutaler-anwalt HOCH findings as "not blocking mid-audit" — track in checkpoint; final pass must address them.
@@ -0,0 +1,258 @@
1
+ # Phase 7 Reference — Final-Verify (9-Gate Loop + Briefing-Coverage + Status-Report)
2
+
3
+ Phase 7 is the final pass. All 9 quality-gates run. Briefing-coverage check. Lighthouse mobile + desktop. Final brutaler-anwalt full-pass. Status-report DONE or INCOMPLETE. **Time budget:** 30-45 min plus repair-iterations if needed.
4
+
5
+ ---
6
+
7
+ ## The 9 Gates (full-final mode)
8
+
9
+ Per `aegis-quality-gates` skill, the canonical sequence:
10
+
11
+ | # | Gate | Threshold | When red, action |
12
+ |---|---|---|---|
13
+ | 1 | build | exit 0 | Fix compile error, re-run |
14
+ | 2 | tsc | 0 errors | Fix type error, re-run |
15
+ | 3 | lint | 0 errors | Auto-fix or manual fix |
16
+ | 4 | tests | 100% pass | Fix test or fix code |
17
+ | 5 | aegis-scan | score ≥ 950, grade S/FORTRESS | Identify failing tier, repair, re-scan |
18
+ | 6 | brutaler-anwalt full-pass | 0 KRITISCH, ≤ 2 HOCH | Fix legal-finding, re-run |
19
+ | 7 | lighthouse | Mobile ≥ 75, Desktop ≥ 90, A11y/SEO/BP = 100 | Optimize, re-run |
20
+ | 8 | skillforge-validate | 16/17+ per touched skill | Fix skill-structure, re-validate |
21
+ | 9 | briefing-coverage | 100% pages exist | Build missing page, re-check |
22
+
23
+ Each gate writes a structured result to `.aegis/verify-report.json`. The post-build status-report reads from this JSON.
24
+
25
+ ---
26
+
27
+ ## Gate 9: Briefing-Coverage Check
28
+
29
+ The most foundation-specific gate. Verifies every page in the briefing exists in the artifact.
30
+
31
+ ```ts
32
+ // scripts/check-briefing-coverage.ts
33
+ import { readFileSync, existsSync } from 'node:fs';
34
+
35
+ const briefing = JSON.parse(readFileSync('.aegis/briefing-parsed.json', 'utf-8'));
36
+ const expectedPages = briefing.pages;
37
+ const missing: string[] = [];
38
+ const incomplete: string[] = [];
39
+
40
+ for (const page of expectedPages) {
41
+ const filePath = page.slug === 'home'
42
+ ? 'app/page.tsx'
43
+ : `app/${page.slug}/page.tsx`;
44
+
45
+ if (!existsSync(filePath)) {
46
+ missing.push(`${page.slug}: file not found at ${filePath}`);
47
+ continue;
48
+ }
49
+
50
+ const content = readFileSync(filePath, 'utf-8');
51
+
52
+ // Verify metadata exported
53
+ if (!content.includes('export const metadata') && !content.includes('export async function generateMetadata')) {
54
+ incomplete.push(`${page.slug}: missing metadata export`);
55
+ }
56
+
57
+ // Verify each section in briefing.sections[] is present
58
+ for (const section of page.sections) {
59
+ if (!sectionPresent(content, section)) {
60
+ incomplete.push(`${page.slug}: section "${section}" not found in JSX`);
61
+ }
62
+ }
63
+ }
64
+
65
+ if (missing.length || incomplete.length) {
66
+ console.error('Briefing-coverage RED:', { missing, incomplete });
67
+ process.exit(1);
68
+ }
69
+ console.log(`Briefing-coverage OK: ${expectedPages.length}/${expectedPages.length} pages`);
70
+ ```
71
+
72
+ `sectionPresent` is a heuristic: looks for component-name-match or comment-marker. Customize per project's library naming.
73
+
74
+ ---
75
+
76
+ ## Lighthouse Invocation (Mobile + Desktop)
77
+
78
+ ```bash
79
+ # Build production
80
+ cd customers/<slug>
81
+ pnpm run build
82
+ pnpm run start &
83
+ SERVER_PID=$!
84
+ until curl -sf http://localhost:3000 > /dev/null; do sleep 1; done
85
+
86
+ # Mobile
87
+ npx -y @lhci/cli@latest collect \
88
+ --url=http://localhost:3000 \
89
+ --settings.preset=mobile \
90
+ --output-path=./audits/lhci-mobile.json
91
+
92
+ # Desktop
93
+ npx -y @lhci/cli@latest collect \
94
+ --url=http://localhost:3000 \
95
+ --settings.preset=desktop \
96
+ --output-path=./audits/lhci-desktop.json
97
+
98
+ kill $SERVER_PID
99
+
100
+ # Parse
101
+ node scripts/parse-lhci.mjs ./audits/lhci-mobile.json ./audits/lhci-desktop.json
102
+ ```
103
+
104
+ `parse-lhci.mjs`:
105
+
106
+ ```js
107
+ import { readFileSync } from 'node:fs';
108
+
109
+ const mobile = JSON.parse(readFileSync(process.argv[2]));
110
+ const desktop = JSON.parse(readFileSync(process.argv[3]));
111
+
112
+ const m = mobile.lhr.categories;
113
+ const d = desktop.lhr.categories;
114
+
115
+ const result = {
116
+ mobile: {
117
+ performance: Math.round(m.performance.score * 100),
118
+ accessibility: Math.round(m.accessibility.score * 100),
119
+ seo: Math.round(m.seo.score * 100),
120
+ bestPractices: Math.round(m['best-practices'].score * 100),
121
+ },
122
+ desktop: {
123
+ performance: Math.round(d.performance.score * 100),
124
+ accessibility: Math.round(d.accessibility.score * 100),
125
+ seo: Math.round(d.seo.score * 100),
126
+ bestPractices: Math.round(d['best-practices'].score * 100),
127
+ },
128
+ };
129
+
130
+ const fails: string[] = [];
131
+ if (result.mobile.performance < 75) fails.push(`mobile.performance ${result.mobile.performance} < 75`);
132
+ if (result.desktop.performance < 90) fails.push(`desktop.performance ${result.desktop.performance} < 90`);
133
+ if (result.mobile.accessibility < 100) fails.push(`mobile.a11y ${result.mobile.accessibility} < 100`);
134
+ // ... etc
135
+
136
+ console.log(JSON.stringify(result, null, 2));
137
+ if (fails.length) {
138
+ console.error('Lighthouse RED:', fails);
139
+ process.exit(1);
140
+ }
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Final Brutaler-Anwalt Full-Pass
146
+
147
+ Unlike Phase 6's HUNT-mode (topic-scoped), Phase 7 runs the FULL 8-layer audit:
148
+
149
+ ```bash
150
+ npx -y @aegis-scan/skills run compliance/brutaler-anwalt \
151
+ --mode=full \
152
+ --target=http://localhost:3000 \
153
+ --output=./audits/final-anwalt.md \
154
+ --format=4-section
155
+ ```
156
+
157
+ Output is the canonical 4-section format:
158
+
159
+ 1. **Schadens-Diagnose** — top-level summary with €-range estimate.
160
+ 2. **Findings-Tabelle** — detailed per-finding (severity, layer, evidence, fix-suggestion).
161
+ 3. **Anwalts-Anhang** — legal citations (Art. paragraph + court-decision references).
162
+ 4. **Abmahn-Simulation** — likelihood × industry × visibility = probable cost.
163
+
164
+ **Final-pass thresholds:**
165
+
166
+ - 0 KRITISCH (any KRITISCH = INCOMPLETE-Status)
167
+ - ≤ 2 HOCH (each HOCH explicitly listed in status-report)
168
+ - MITTEL + LOW: tracked but non-blocking
169
+
170
+ If KRITISCH found: enter repair-attempt-loop (max 3) for KRITISCH-only. HOCH/MITTEL are post-launch-tasks.
171
+
172
+ ---
173
+
174
+ ## .aegis/verify-report.json Schema
175
+
176
+ ```json
177
+ {
178
+ "timestamp": "2026-04-28T14:00:00Z",
179
+ "project_slug": "test-customer-001",
180
+ "status": "DONE" | "INCOMPLETE",
181
+ "gates": {
182
+ "build": {"pass": true, "duration_ms": 8421},
183
+ "tsc": {"pass": true, "errors": 0},
184
+ "lint": {"pass": true, "errors": 0},
185
+ "tests": {"pass": true, "passed": 145, "total": 145},
186
+ "aegis_scan": {"pass": true, "score": 994, "grade": "S", "bracket": "FORTRESS"},
187
+ "anwalt": {"pass": true, "kritisch": 0, "hoch": 1, "report": "audits/final-anwalt.md"},
188
+ "lighthouse": {
189
+ "pass": true,
190
+ "mobile": {"performance": 82, "accessibility": 100, "seo": 100, "best_practices": 100},
191
+ "desktop": {"performance": 95, "accessibility": 100, "seo": 100, "best_practices": 100}
192
+ },
193
+ "skillforge_validate": {"pass": true, "skills_validated": []},
194
+ "briefing_coverage": {"pass": true, "expected": 13, "actual": 13, "missing": []}
195
+ },
196
+ "open_items": []
197
+ }
198
+ ```
199
+
200
+ If `status: INCOMPLETE`, `open_items` lists every failing gate-item with severity.
201
+
202
+ ---
203
+
204
+ ## Status-Report Format (post-build)
205
+
206
+ The customer-build SKILL.md's Process specifies the canonical text. Phase 7 generates it from `.aegis/verify-report.json`:
207
+
208
+ **DONE template:**
209
+
210
+ ```
211
+ Bin fertig, Chef.
212
+ - Site unter customers/<slug>/
213
+ - AEGIS Score: <score>/<grade>/<bracket>
214
+ - Lighthouse: Mobile <m_perf>/Desktop <d_perf> (A11y/SEO/BP all <100|99>)
215
+ - brutaler-anwalt: <kritisch> KRITISCH, <hoch> HOCH
216
+ - Briefing-Coverage: <built>/<expected> pages (<pct>%)
217
+ - Audit-Report: customers/<slug>/audits/final.md
218
+ - Bereit für deploy.
219
+ ```
220
+
221
+ **INCOMPLETE template:**
222
+
223
+ ```
224
+ BUILD INCOMPLETE — folgende Items offen:
225
+ - [ ] aegis-scan score 928 < 950 (target). Failing tier: T1-DNS-NO-DNSSEC.
226
+ - [ ] anwalt KRITISCH 1: Impressum fehlt VAT-ID (line 47 of /impressum/page.tsx)
227
+ - [ ] briefing-coverage 12/13 — fehlt: page "blog/karriere" (briefing line 412)
228
+ - [ ] lighthouse mobile.performance 67 < 75. Hauptursache: LCP > 4s.
229
+ Repair-attempt-Count: 3/3 erschöpft.
230
+ Empfehlung: Operator-Eingriff für T1-DNS (DNS-level), VAT-ID-Eintrag, blog/karriere-page-Build, LCP-Optimierung.
231
+ ```
232
+
233
+ Always exact, with concrete file/line/page references.
234
+
235
+ ---
236
+
237
+ ## Phase 7 Completion Criteria
238
+
239
+ - [ ] All 9 gates ran (no skipping)
240
+ - [ ] `.aegis/verify-report.json` written
241
+ - [ ] Audit-report `audits/final.md` consolidated (combines AEGIS-scan + anwalt + lighthouse outputs)
242
+ - [ ] Status-report printed to operator (DONE or INCOMPLETE template)
243
+ - [ ] If DONE: state.json `status: DONE` set
244
+ - [ ] If INCOMPLETE: state.json `status: INCOMPLETE`, `open_items[]` populated
245
+ - [ ] Operator-actionable (operator can copy-paste status-report into deploy-tracker)
246
+
247
+ ---
248
+
249
+ ## Anti-Patterns specific to Phase 7
250
+
251
+ - ❌ Reporting "DONE" with score < 950 (never round up)
252
+ - ❌ Skipping any gate in final-verify (mid-audit subsetting was Phase 6)
253
+ - ❌ Mocking Lighthouse run because "the dev-server isn't started" — start it, run real Lighthouse
254
+ - ❌ Reporting briefing-coverage as 100% when one page is a stub (e.g., 50 chars of copy) — coverage requires meta + sections + content
255
+ - ❌ Hiding HOCH findings in the status-report — every HOCH gets listed
256
+ - ❌ Auto-deploying after DONE status without operator-confirm — deploy is an operator-action
257
+ - ❌ Repair-attempt-loop running > 3 iterations on the same gate — escalate to INCOMPLETE
258
+ - ❌ Skipping `.aegis/verify-report.json` — downstream tooling depends on it
@@ -0,0 +1,128 @@
1
+ <!-- aegis-local: AEGIS-native skill, MIT-licensed; writes the structured session-end handover, captures progress + open items + skill-changes + recommendations, then updates the HANDOVER-LATEST.md symlink so the next agent starts with full context. Pattern ported from a private reference-implementation; this is the public OSS variant. -->
2
+ ---
3
+ name: aegis-handover-writer
4
+ description: Writes the session-end handover. Captures completed-work, quality-gate metrics, files changed, skill changes, open items 1/2/3, fallstricke, next steps, recommendations. Updates HANDOVER-LATEST.md symlink. Trigger keywords - handover, session-ende, fertig, übergabe, recap, abschluss.
5
+ model: sonnet
6
+ license: MIT
7
+ metadata:
8
+ required_tools: "file-ops,shell-ops"
9
+ required_audit_passes: "0"
10
+ enforced_quality_gates: "0"
11
+ pre_done_audit: "false"
12
+ ---
13
+
14
+ # aegis-handover-writer — Session-End Handover
15
+
16
+ Writes a structured handover-file at `.claude/handover/HANDOVER-YYYY-MM-DD-<topic>.md` and updates `HANDOVER-LATEST.md` symlink. Continuous updates supported during long sessions (overwrite-or-append based on whether `HANDOVER-LATEST.md` already exists for today).
17
+
18
+ ---
19
+
20
+ ## HARD-CONSTRAINT — Handover-Completeness
21
+
22
+ The handover-file MUST include all 8 sections listed under `## Verification / Success Criteria`. Skipping a section breaks the next agent's bootstrap. If a section legitimately has nothing to report (e.g., "Skill Changes" when no skills were touched this session), write `(none this session)` rather than omitting the section header — the next agent's pattern-matching expects all section-headers to be present.
23
+
24
+ References + cross-links to the foundation spec (`seitengold/docs/2026-04-28-aegis-agent-foundation-design.md`) belong in `## Recommendations` if they affect the operator's next decisions, not buried in `## Status`.
25
+
26
+ ---
27
+
28
+ ## Mission
29
+
30
+ Eliminate the "next agent starts blind" failure mode at session-boundaries. The handover-file IS the bootstrap-input for whoever opens the next session — Claude Code, Codex, or human operator. Quality of handover directly determines quality of next-session start.
31
+
32
+ Plus: enable **continuous-handover** during long autonomous builds. Write incremental updates to `HANDOVER-LATEST.md` after each major phase, not just at session-end. If a long-running build crashes mid-Phase-3, the resume-agent finds the partial handover documenting Phase-1+2 already done.
33
+
34
+ ---
35
+
36
+ ## Triggers
37
+
38
+ ### Slash-commands
39
+
40
+ - `/handover` — write session-end handover
41
+ - `/übergabe` — alias
42
+ - `/session-ende` — alias
43
+ - `/recap` — alias
44
+
45
+ ### Auto-trigger keywords
46
+
47
+ - handover, übergabe, session-ende, fertig, recap, abschluss, weitermachen-vorbereitung
48
+ - Plus: when the orchestrator detects a phase-completion event in a long-running build
49
+
50
+ ### Continuous-update trigger
51
+
52
+ When invoked with `--continuous` (or a CLI-invocation from another skill), updates `HANDOVER-LATEST.md` in-place rather than writing a new dated file. Used by `aegis-customer-build` after each of its 7 phases.
53
+
54
+ ---
55
+
56
+ ## Process
57
+
58
+ ### Phase 1: Determine handover-filename
59
+
60
+ For session-end (default): `HANDOVER-YYYY-MM-DD-<topic-slug>.md` based on date + 1-3-word session-topic. The topic is inferred from the last user-request or extracted from `.aegis/state.json` `current_phase`.
61
+
62
+ For continuous-update: write to `HANDOVER-LATEST.md` directly (which is itself a symlink to today's dated file) and append rather than overwrite.
63
+
64
+ ### Phase 2: Gather inputs
65
+
66
+ Read these in order:
67
+ - `git log --oneline -20` — recent commits with SHAs
68
+ - `.aegis/state.json` — current state, last completed phase, project-skills
69
+ - `git status --short` — unstaged changes, anything still in flight
70
+ - `git diff main..HEAD --name-only` — files changed this branch
71
+ - For Skill Changes: scan `~/.claude/skills/` and `<repo>/.claude/skills/` for files modified since the last handover
72
+
73
+ ### Phase 3: Write the handover-file
74
+
75
+ Use the template under `## Verification / Success Criteria` below. Each section MUST be present (write `(none this session)` if empty).
76
+
77
+ ### Phase 4: Update symlink
78
+
79
+ ```bash
80
+ cd .claude/handover/
81
+ ln -sf HANDOVER-YYYY-MM-DD-<topic>.md HANDOVER-LATEST.md
82
+ ```
83
+
84
+ Verify: `readlink HANDOVER-LATEST.md` returns the right target.
85
+
86
+ ### Phase 5: Commit (optional)
87
+
88
+ If the orchestrator asked for a `--commit` flag: `git add .claude/handover/ && git commit -m "docs(handover): YYYY-MM-DD-<topic>"`. Otherwise leave the file uncommitted — operator commits at their discretion.
89
+
90
+ ---
91
+
92
+ ## Verification / Success Criteria
93
+
94
+ The handover-file MUST contain these 8 sections, in order:
95
+
96
+ - [ ] `## Status` — bullet-list of what was completed this session, with concrete file-paths + commit-SHAs (e.g., `b837c6d release(skills): bump to 0.3.0`)
97
+ - [ ] `## Metrics` — quality-gate results (build / tsc / lint / tests / aegis-scan / brutaler-anwalt / lighthouse / skillforge-validate / briefing-coverage)
98
+ - [ ] `## Files Changed` — list of new + modified files (`git diff main..HEAD --name-only`)
99
+ - [ ] `## Skill Changes` — any SKILL.md edits, new skills, frontmatter updates, references added — even minor changes get tracked here
100
+ - [ ] `## Open (Pri 1/2/3)` — what's left, prioritized: P1 = blocker for next session, P2 = should-do-soon, P3 = nice-to-have
101
+ - [ ] `## Known Fallstricke` — gotchas to remember (e.g., "the SkillForge validator rejects top-level frontmatter fields outside the allowlist; use metadata: nesting")
102
+ - [ ] `## Next Steps` — concrete actions for the next session, ordered by sequence (e.g., "1. Run `pnpm test`. 2. If green, push the branch. 3. Open PR.")
103
+ - [ ] `## Recommendations` — what the operator should do (deploy, review, npm-publish, etc.) — actions that need human-judgment
104
+
105
+ Plus the symlink check:
106
+ - [ ] `readlink .claude/handover/HANDOVER-LATEST.md` returns the new file (not a stale earlier handover)
107
+
108
+ ---
109
+
110
+ ## Anti-Patterns
111
+
112
+ - ❌ Vague status ("worked on stuff") — must be concrete with file-paths + commit-SHAs
113
+ - ❌ Missing skill-changes section — even minor frontmatter edits must be tracked (next agent needs to know)
114
+ - ❌ Skipping symlink update — next session won't find the latest handover
115
+ - ❌ Mixing P1 and P3 items in the same list — prioritize, don't dump
116
+ - ❌ "We'll fix this later" without a Pri-line — every deferred item belongs in Open (Pri X)
117
+ - ❌ Writing the handover BEFORE the current phase is actually complete — handover comes after the work, not as a way to declare it done
118
+ - ❌ Overwriting a continuous-handover with a session-end-handover when both happen on the same day — append + symlink-rotate, don't lose history
119
+
120
+ ---
121
+
122
+ ## Extension Points
123
+
124
+ - **Per-use-case handover-templates** — drop a custom template into `.claude/handover/templates/<use-case>.md`. The skill detects it via filename-match and uses it instead of the default template. Useful when customer-build sessions need a different shape than compliance-audit sessions.
125
+ - **Domain-specific sections** — extend the 8-section template with extra sections (e.g., `## Security Findings` for compliance-audit, `## Pages Built` for customer-build). Add to the use-case template.
126
+ - **External system updates** — add hooks that, after writing the handover-file, update Linear / Jira / Slack with a summary. Implement as PostToolUse hooks in `.claude/settings.json`, NOT as logic inside this skill.
127
+ - **Continuous-handover-frequency** — for very long builds (4-5h+), the customer-build orchestrator can call this skill with `--continuous` after every phase. Each call appends to `HANDOVER-LATEST.md` rather than rotating to a new dated file.
128
+ - **Per-handover sign-off** — add a `## Operator Sign-off` section template for handovers that require explicit human review before next-session-resume. Useful for production-deploy gates.