|
1 | 1 | # ShieldCraft Engine — Context Anchor |
2 | 2 |
|
3 | | -## What This Project Is |
| 3 | +## Domain Map |
4 | 4 |
|
5 | | -- ShieldCraft Engine is a deterministic software manufacturing engine that validates canonical product specifications and produces auditable, reproducible build artifacts for review and CI. |
| 5 | +- **Engine Core** |
| 6 | + - Authoritative: `src/shieldcraft/engine.py`, `src/shieldcraft/main.py` |
| 7 | + - Supporting: `src/shieldcraft/services/*`, `src/shieldcraft/dsl/*` |
| 8 | +- **DSL / Spec** |
| 9 | + - Authoritative: `spec/se_dsl_v1.spec.json`, `spec/schemas/se_dsl_v1.schema.json`, `spec/se_dsl_v1.template.json` |
| 10 | + - Supporting: `spec/README.md`, `spec/pointer_map.json` |
| 11 | +- **Checklist** |
| 12 | + - Authoritative: `src/shieldcraft/services/checklist/generator.py`, `src/shieldcraft/services/checklist/*` |
| 13 | + - Tests: `tests/checklist/*` |
| 14 | +- **Verification** |
| 15 | + - Authoritative: `src/shieldcraft/verification/*`, `docs/governance/VERIFICATION_SPINE.md` |
| 16 | + - Tools: `scripts/canonical_full_run.py`, `scripts/canonicalize_spec.py` |
| 17 | +- **Persona** |
| 18 | + - Authoritative: `src/shieldcraft/persona/__init__.py`, `src/shieldcraft/persona/persona_evaluator.py`, `docs/persona/PERSONA_PROTOCOL.md` |
| 19 | + - Tests: `tests/persona/*` |
| 20 | +- **Governance** |
| 21 | + - Authoritative: `docs/governance/decision_log.md`, `docs/governance/INVARIANTS.md`, `docs/governance/OPERATIONAL_READINESS.md`, `docs/governance/CONTRACTS.md`, `docs/governance/progress.md` |
| 22 | + - Audit tooling: `scripts/audit_docs.py`, `artifacts/governance/doc_classification_report.json` |
6 | 23 |
|
7 | | -## What Is Complete |
| 24 | +## Execution Flow (fact-backed) |
8 | 25 |
|
9 | | -- Canonical DSL and schema: `spec/se_dsl_v1.spec.json` and `spec/schemas/se_dsl_v1.schema.json`. |
10 | | -- Determinism tooling and checks: `scripts/canonical_full_run.py`, `scripts/canonicalize_spec.py`, and related tests (e.g., `tests/ci/test_canonical_full_run_regression.py`, `tests/spec/test_canonical_json.py`). |
11 | | -- Self-host dry-run and artifact emission tooling, including deterministic preview and manifest emission (see `src/shieldcraft/engine.py` and self-host scripts). |
12 | | -- Governance artifacts and audits: governance docs and audit script (`docs/governance/*`, `scripts/audit_docs.py`, `artifacts/governance/doc_classification_report.json`). |
13 | | -- Persona subsystem (opt-in) with non-interference rules and tests (`docs/persona/*`, persona code under `src/shieldcraft/persona`, and persona tests under `tests/persona/`). |
14 | | -- Test Attachment Contract (TAC) implemented as an opt-in enforcement (environment flag `SHIELDCRAFT_ENFORCE_TEST_ATTACHMENT`) and related validators/tests present. |
15 | | -- Generated verification tests exist under `tests/generated/verification_spine/` and test-generation scripts under `scripts/`. |
| 26 | +- **Spec ingestion** — `load_spec()` used in `engine.execute()`; canonical loader in `src/shieldcraft/dsl/canonical_loader.py` (tests: `tests/spec/test_canonical_loader_roundtrip.py`). |
| 27 | +- **Validation** — `validate_spec_against_schema(spec, schema_path)` in `engine.execute()` (schema: `spec/schemas/se_dsl_v1.schema.json`); instruction validation via `_validate_spec(spec)` in `engine.run_self_host()` and `engine.execute()`. |
| 28 | +- **Checklist synthesis** — `self.checklist_gen.build(spec, ast=ast, engine=self)` (implementation: `src/shieldcraft/services/checklist/generator.py`). |
| 29 | +- **Verification gates** — determinism snapshots via `src/shieldcraft/verification/seed_manager.py` (engine attaches `_determinism`); readiness via `src/shieldcraft/verification/readiness_evaluator.py` and `readiness_report.py`. |
| 30 | +- **Self-host preview** — `engine.run_self_host(spec, dry_run=True, emit_preview=...)` returns `preview`; validated by `src/shieldcraft/services/selfhost/preview_validator.py`. |
| 31 | +- **Artifact emission** — on non-dry-run: builds `.selfhost_outputs/{fingerprint}`, writes `bootstrap_manifest.json` and `repo_snapshot.json` (see `engine.run_self_host()`). |
| 32 | +- **Determinism comparison** — `scripts/canonical_full_run.py` canonicalizes previews and compares `canonical_preview.json`; regression test: `tests/ci/test_canonical_full_run_regression.py`. |
16 | 33 |
|
17 | | -## What Is In Progress |
| 34 | +## Persona Protocol (implementation facts) |
18 | 35 |
|
19 | | -- Phase 14 remediation: self-hosting validation failures are triaged and remediation work is started (`docs/governance/progress.md` shows `self-hosting-remediation: STARTED`). |
20 | | -- Consolidation of verification and governance documentation (e.g., `docs/governance/VERIFICATION_SPINE.md` added/expanded). |
21 | | -- Integrating determinism regression checks into CI (regression test added at `tests/ci/test_canonical_full_run_regression.py`). |
22 | | -- Implementation PRs for approved RFCs are being prepared (spec changes are approved; implementation work is tracked in `docs/governance/progress.md`). |
| 36 | +- **Activation** — opt-in via `SHIELDCRAFT_PERSONA_ENABLED` (`src/shieldcraft/persona/__init__.py`). |
| 37 | +- **Loading** — engine calls `find_persona_files` / `resolve_persona_files` and may set `self.persona` to a `PersonaContext` in `engine.run_self_host()` when enabled. |
| 38 | +- **Non-interference** — persona evaluator is non-mutating (`src/shieldcraft/persona/persona_evaluator.py`); persona events are data-only (`docs/persona/legacy/PERSONA_EVENTS.md`); tests enforce behavior (`tests/persona/*`). |
| 39 | +- **Veto/Refusal** — persona veto exists as a terminal refusal path (docs and tests: `PERSONA_EVENTS.md`, `tests/persona/test_persona_veto.py`). |
23 | 40 |
|
24 | | -## What Is Explicitly Not Done |
| 41 | +## Verification Spine (invariants, enforcement, tests) |
25 | 42 |
|
26 | | -- A formal progress/state file schema is not defined (`docs/governance/progress.md` lists this as an open gap). |
27 | | -- Remaining implementation of approved RFCs is pending review and PRs (the spec-level RFCs are approved; code/tests implementing them remain gated to PRs). |
28 | | -- Phase 14 self-hosting validation is not completed; failures remain and remediation is ongoing. |
| 43 | +- **Determinism** |
| 44 | + - Defined: `spec/schemas/se_dsl_v1.schema.json` (determinism section); `spec/se_dsl_v1.spec.json` includes determinism tasks. |
| 45 | + - Enforcement: `src/shieldcraft/verification/determinism_contract.py`, `seed_manager.py`, and `engine.run_self_host()` canonicalization/header injection. |
| 46 | + - Tests: `tests/ci/test_canonical_full_run_regression.py`, `tests/spec/test_canonical_json.py`, `tests/verification/test_seed_stability.py`. |
| 47 | +- **Test Attachment Contract (TAC)** |
| 48 | + - Defined: governance docs and code references to `SHIELDCRAFT_ENFORCE_TEST_ATTACHMENT` (`src/shieldcraft/engine.py`, `src/shieldcraft/services/validator/tests_attached_validator.py`). |
| 49 | + - Enforcement: opt-in; tests exercise behavior when env var set (`tests/validator/test_tests_attached_integration.py`). |
| 50 | +- **Readiness / Blocking invariants** |
| 51 | + - Defined: `src/shieldcraft/verification/readiness_contract.py`, `docs/governance/VERIFICATION_SPINE.md`. |
| 52 | + - Enforcement: `readiness_evaluator.py` attaches `_readiness` and `_readiness_report` in engine. |
| 53 | + - Tests: `tests/verification/test_readiness_*`. |
29 | 54 |
|
30 | | -## Current Focus |
| 55 | +## Authoritative vs Supporting Docs |
31 | 56 |
|
32 | | -- Current active phase: Verification / Testing Spine. This phase exists to ensure engine outputs meet structural, semantic, and determinism guarantees by running deterministic previews, emitting canonical digests, and producing audit-ready artifacts for CI and external validation (see `docs/governance/VERIFICATION_SPINE.md` and `docs/governance/progress.md`). |
| 57 | +- **Authoritative** (govern behavior): `docs/governance/decision_log.md`, `docs/governance/INVARIANTS.md`, `docs/governance/OPERATIONAL_READINESS.md`, `docs/governance/CONTRACTS.md`, `docs/governance/progress.md`, `docs/governance/SE_V1_CLOSED.md`. |
| 58 | +- **Supporting** (how-to, examples): `docs/persona/*`, `spec/README.md`, `spec/se_dsl_v1.template.json`. |
| 59 | +- **Historical / Phase artifacts**: `docs/archive/*`, `docs/phases/*`. |
| 60 | +- **Audit outputs / artifacts**: `artifacts/governance/doc_classification_report.json`, `artifacts/canonicalization/*`, `artifacts/canonical_full_run/*`. |
33 | 61 |
|
34 | | -## How This File Is Used |
| 62 | +## Known Gaps and Explicit Non-Goals |
35 | 63 |
|
36 | | -- This file is an authoritative, short snapshot of repository state for use in conversation resets and onboarding. Update it only when factual repository state changes and record changes in `docs/governance/decision_log.md` and via `scripts/audit_docs.py`. |
| 64 | +- **Known gaps** (explicit in `docs/governance/progress.md`): formal progress/state file schema not defined; Phase 14 self-hosting validation failed and remediation is STARTED; specific failing tests classified as spec gaps (bootstrap artifacts, pointer map coverage, generator lockfile contract, checklist normalization). |
| 65 | +- **Explicit non-goals**: no feature implementation during foundation-alignment; one-RFC-per-PR and spec-first commit requirements (`docs/pr_structure_phase13.md`). |
| 66 | + |
| 67 | +## Context Anchor v2 (single-screen snapshot) |
| 68 | + |
| 69 | +- **What it is:** Deterministic software manufacturing engine that validates canonical DSL specs and emits auditable, reproducible build artifacts and previews (`spec/`, `src/shieldcraft/engine.py`). |
| 70 | +- **Authority:** Canonical DSL/schema (`spec/se_dsl_v1.spec.json`, `spec/schemas/se_dsl_v1.schema.json`) and governance docs (`docs/governance/*`). |
| 71 | +- **Current focus:** Verification & Testing Spine (determinism checks, readiness evaluation, TAC gating, self-host validation remediation). |
| 72 | +- **Selected facts complete:** canonical DSL/schema present; determinism tooling and regression test present; persona opt-in and non-interference tests present. |
| 73 | +- **Selected facts incomplete:** Phase 14 self-hosting validation remediation in progress; formal progress/state file schema OPEN. |
| 74 | +- **Use:** Short authoritative snapshot for conversation resets and onboarding; record updates in `docs/governance/decision_log.md`. |
0 commit comments