Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto

# Trailing double-space is meaningful Markdown (hard line break) - do not flag it
*.md whitespace=-blank-at-eol
200 changes: 100 additions & 100 deletions CLAUDE.md

Large diffs are not rendered by default.

1,018 changes: 509 additions & 509 deletions README.md

Large diffs are not rendered by default.

187 changes: 94 additions & 93 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,94 @@
# Continuum — TODO

Live milestone + debt tracker. Suite: **589 passing + 7 xfail** (known-gap pins).

## Open items

### M7 — remaining before/at live deployment

- [x] **T2 longitudinal cohort re-sample (2026-07-22/23)** — identity 0/8 (no drift), first
A1.6 falsification check on CadenceIntegrity's ±5s grounding passed. T3 follows ~2026-07-30.
- [ ] **First live post — a GO DECISION, not an engineering task.** Requires its own governed
envelope + operator go-ahead + live wiring of a real `submit_captcha_fn` against
`POST /api/v1/verify` (the seam is injected everywhere in tests; live wiring has
deliberately never happened). Transport spec Note E stop conditions apply.
- [ ] IdentityIntegrity v1.1 cross-session change-rate threshold — blocked on T2/T3 data.
- [ ] CitationClusterIntegrity §5 grounding amendment — trigger is first real M7 citation
activity by our deployed agent; until then the constraint is structurally NOT EVALUABLE.

### Infrastructure / process debt

- [x] Claude Code scaffold hooks (PR #30) installed 2026-07-24 — reworked from the scaffold's
bash/`CLAUDE_*`-env-var shape to the current stdin-JSON hook interface as three Python
scripts in `.claude/hooks/` (pre-Bash destructive-command guard, post-Write/Edit targeted
pytest for `pi_script/`/`rift/`/`moltbook/`, Stop-time full suite + Discord notify) wired
via `.claude/settings.json`. Local-only by design (`.gitignore` keeps `.claude/*` private
except skills). `DISCORD_WEBHOOK_URL` env var enables the notify path; unset = suite still
runs, result printed only.
- [x] `PISCRIPTGOVERNANCE` PAT expiry debt CLOSED 2026-07-23: pre-flight expiry-warning step +
run-failure Discord net shipped to Melody-Maestro `governance.yml` (PR #1 `c3f5822`),
token rotated (90-day fine-grained, Contents R/W both repos, expires 2026-10-21 —
auto-warns #pi-logs at ≤14d ~10/07 and ≤3d ~10/18), renewal doc corrected (PR #2
`ed17351`). If #pi-logs goes quiet anyway: `gh run list -R GodSpeed313/Melody-Maestro`.

### xfail census (7 — deliberate known-gap pins, not failures)

- 3 × CredentialIntegrity encoding exfil (base64 / reversed / split-within-prefix)
- 3 × IdentityIntegrity (semantic persona-drift; A4 quoted-speech; A2 residual truncation)
- 1 × captcha solver: whitespace-shattered words (Note F §F.5 residual)

---

## Milestone tracker

- [x] M1 — Grammar finalized
- [x] M2 — Semantic validator, 12/12 tests passing
- [x] M3 — Parser — 9/9 tests passing
- [x] M4 — Resolver core — 89/89 tests passing
- [x] M5 — Dogfood — gate met (6+ violations across two independent systems: 2 Continuum session + 4+ Melody Maestro automated, 23-day active run)
- [x] M6 — Publish — ConsistencyGuard activated, Rift v0.1 shipped, Jupyter playground live (paper at docs/m6_paper_draft1.md)
- [ ] M7 — Moltbook deployment — **engineering complete, not yet live** (see open items above)

## v0.2 ruling tracker

- [x] Ruling 9.4 — bidirectional map blocks (PR #10)
- [x] Ruling 9.5 — cross-domain constraint inheritance (PR #11)
- [x] Ruling 9.6 — persistent violation counters (PR #12)
- [x] Ruling 9.7 — arbiter mandatory + flag-as-always-additive (PR #13)
- [x] Ruling 9.8 — semantic similarity map matching (PR #14, #15)
- [x] Ruling 9.9 — standing bound rule / Form 7 (PR #16)

Pending rulings: none. Spec doc (`docs/pi_script_v02_draft5.md`, Draft 10) confirms.

## Tooling / integration (post-9.9)

- [x] MCP server exposing governance checks as a tool (PR #18)
- [x] Persistence + cross-process write-queue for `check_governance` (PR #19)
- [x] Read-only governance dashboard (PR #20)
- [x] Quantization-governance domain example — corrected to valid v0.2 syntax, proves grammar is domain-general (PR #21)

## Rift v0.2 (Layer 3 rulings)

- [x] Ruling 3.1 — two-tier semantic declaration matching, independent MiniLM instance (PR #26, `4ff5e7f`)
- [x] Ruling 3.2 — known-values accumulation, `RiftSession` (PR #27, `04b747f`)

## M7 shipped log

- [x] Claude Code scaffold: CLAUDE.md + three skills (PR #30, `3172e5a`)
- [x] CredentialIntegrity — ruling + key isolation + pre-send gate (PR #31, `0db3f2e`)
- [x] LinkRestriction — provenance check + allowlist + reshare log (PR #32, `a3a5be6`)
- [x] IdentityIntegrity v1 — within-session, mechanical-only detection (PR #33, `6c558e5`)
- [x] IdentityIntegrity Addendum 1 — A1–A6 external-review fixes (PR #34, `c5f51aa`)
- [x] CadenceIntegrity — longitudinal constraint, provisional §5 params (PR #35, `7dbbed9`)
- [x] CitationClusterIntegrity — directional edges, ungrounded-§5-by-design (PR #36, `e8dbb92`)
- [x] README M7 section (PR #37, `71c5031`)
- [x] CadenceIntegrity Amendment 1 — J ±3s→±5s, grounded from T1 cohort (PR #38, `809b5c1`)
- [x] Moltbook transport boundary — locked spec + Notes A/B/C (PR #39, `9b4ec71`)
- [x] Implementation Note D — request_fn header capture, RateLimitInfo (PR #40, `819cfa0`)
- [x] Implementation Note E — captcha issuance protocol, verification gates publication (PR #41, `1bbead6`)
- [x] Trace status contract — suspended rendering, fail-loud unknown statuses (PR #42, `a27b4e5`)
- [x] Implementation Note F — solver extension for documented obfuscation style (PR #43, `ec1f6a0`)
- [x] `tests/test_validator_unit.py` recreated — hand-built Lark Tree harness, 26 tests
(11 happy-path IR extraction, 7 semantic errors, 5 malformed-AST None-guard, 3
conditional-rule variants). Oldest open item (M4 era), never committed before.
# Continuum — TODO

Live milestone + debt tracker. Suite: **589 passing + 7 xfail** (known-gap pins).

## Open items

### M7 — remaining before/at live deployment

- [x] **T2 longitudinal cohort re-sample (2026-07-22/23)** — identity 0/8 (no drift), first
A1.6 falsification check on CadenceIntegrity's ±5s grounding passed. T3 follows ~2026-07-30.
- [ ] **First live post — a GO DECISION, not an engineering task.** Requires its own governed
envelope + operator go-ahead + live wiring of a real `submit_captcha_fn` against
`POST /api/v1/verify` (the seam is injected everywhere in tests; live wiring has
deliberately never happened). Transport spec Note E stop conditions apply.
- [ ] IdentityIntegrity v1.1 cross-session change-rate threshold — blocked on T2/T3 data.
- [ ] CitationClusterIntegrity §5 grounding amendment — trigger is first real M7 citation
activity by our deployed agent; until then the constraint is structurally NOT EVALUABLE.

### Infrastructure / process debt

- [x] Claude Code scaffold hooks (PR #30) installed 2026-07-24 — reworked from the scaffold's
bash/`CLAUDE_*`-env-var shape to the current stdin-JSON hook interface as three Python
scripts in `.claude/hooks/` (pre-Bash destructive-command guard, post-Write/Edit targeted
pytest for `pi_script/`/`rift/`/`moltbook/`, Stop-time full suite + Discord notify) wired
via `.claude/settings.json`. Canonical sources now TRACKED in `tools/claude-hooks/`
(install-hooks.ps1 / verify-hooks.ps1; `.claude/` stays local and generated — see
`docs/scaffold_hooks_reconstruction_note.md` Resolution 2026-07-24). `DISCORD_WEBHOOK_URL`
env var enables the notify path; unset = suite still runs, result printed only.
- [x] `PISCRIPTGOVERNANCE` PAT expiry debt CLOSED 2026-07-23: pre-flight expiry-warning step +
run-failure Discord net shipped to Melody-Maestro `governance.yml` (PR #1 `c3f5822`),
token rotated (90-day fine-grained, Contents R/W both repos, expires 2026-10-21 —
auto-warns #pi-logs at ≤14d ~10/07 and ≤3d ~10/18), renewal doc corrected (PR #2
`ed17351`). If #pi-logs goes quiet anyway: `gh run list -R GodSpeed313/Melody-Maestro`.

### xfail census (7 — deliberate known-gap pins, not failures)

- 3 × CredentialIntegrity encoding exfil (base64 / reversed / split-within-prefix)
- 3 × IdentityIntegrity (semantic persona-drift; A4 quoted-speech; A2 residual truncation)
- 1 × captcha solver: whitespace-shattered words (Note F §F.5 residual)

---

## Milestone tracker

- [x] M1 — Grammar finalized
- [x] M2 — Semantic validator, 12/12 tests passing
- [x] M3 — Parser — 9/9 tests passing
- [x] M4 — Resolver core — 89/89 tests passing
- [x] M5 — Dogfood — gate met (6+ violations across two independent systems: 2 Continuum session + 4+ Melody Maestro automated, 23-day active run)
- [x] M6 — Publish — ConsistencyGuard activated, Rift v0.1 shipped, Jupyter playground live (paper at docs/m6_paper_draft1.md)
- [ ] M7 — Moltbook deployment — **engineering complete, not yet live** (see open items above)

## v0.2 ruling tracker

- [x] Ruling 9.4 — bidirectional map blocks (PR #10)
- [x] Ruling 9.5 — cross-domain constraint inheritance (PR #11)
- [x] Ruling 9.6 — persistent violation counters (PR #12)
- [x] Ruling 9.7 — arbiter mandatory + flag-as-always-additive (PR #13)
- [x] Ruling 9.8 — semantic similarity map matching (PR #14, #15)
- [x] Ruling 9.9 — standing bound rule / Form 7 (PR #16)

Pending rulings: none. Spec doc (`docs/pi_script_v02_draft5.md`, Draft 10) confirms.

## Tooling / integration (post-9.9)

- [x] MCP server exposing governance checks as a tool (PR #18)
- [x] Persistence + cross-process write-queue for `check_governance` (PR #19)
- [x] Read-only governance dashboard (PR #20)
- [x] Quantization-governance domain example — corrected to valid v0.2 syntax, proves grammar is domain-general (PR #21)

## Rift v0.2 (Layer 3 rulings)

- [x] Ruling 3.1 — two-tier semantic declaration matching, independent MiniLM instance (PR #26, `4ff5e7f`)
- [x] Ruling 3.2 — known-values accumulation, `RiftSession` (PR #27, `04b747f`)

## M7 shipped log

- [x] Claude Code scaffold: CLAUDE.md + three skills (PR #30, `3172e5a`)
- [x] CredentialIntegrity — ruling + key isolation + pre-send gate (PR #31, `0db3f2e`)
- [x] LinkRestriction — provenance check + allowlist + reshare log (PR #32, `a3a5be6`)
- [x] IdentityIntegrity v1 — within-session, mechanical-only detection (PR #33, `6c558e5`)
- [x] IdentityIntegrity Addendum 1 — A1–A6 external-review fixes (PR #34, `c5f51aa`)
- [x] CadenceIntegrity — longitudinal constraint, provisional §5 params (PR #35, `7dbbed9`)
- [x] CitationClusterIntegrity — directional edges, ungrounded-§5-by-design (PR #36, `e8dbb92`)
- [x] README M7 section (PR #37, `71c5031`)
- [x] CadenceIntegrity Amendment 1 — J ±3s→±5s, grounded from T1 cohort (PR #38, `809b5c1`)
- [x] Moltbook transport boundary — locked spec + Notes A/B/C (PR #39, `9b4ec71`)
- [x] Implementation Note D — request_fn header capture, RateLimitInfo (PR #40, `819cfa0`)
- [x] Implementation Note E — captcha issuance protocol, verification gates publication (PR #41, `1bbead6`)
- [x] Trace status contract — suspended rendering, fail-loud unknown statuses (PR #42, `a27b4e5`)
- [x] Implementation Note F — solver extension for documented obfuscation style (PR #43, `ec1f6a0`)
- [x] `tests/test_validator_unit.py` recreated — hand-built Lark Tree harness, 26 tests
(11 happy-path IR extraction, 7 semantic errors, 5 malformed-AST None-guard, 3
conditional-rule variants). Oldest open item (M4 era), never committed before.
15 changes: 15 additions & 0 deletions docs/scaffold_hooks_reconstruction_note.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,18 @@ exactly the failure mode that destroys local-only files — the current install
this workstation's `.claude/`, so the tracked-canonical-source option now has a concrete
survivability argument, with this note's file list serving as the reconstruction reference in
the meantime.

## Resolution 2026-07-24 — tracked infrastructure shipped, this note is CLOSED

The operator decided: tracked. "A laptop crash should not be able to erase process controls that
matter to how Continuum is developed." Implemented as `tools/claude-hooks/` (canonical hook
sources + settings template + stdin-schema docs + `install-hooks.ps1` / `verify-hooks.ps1`,
Windows PowerShell 5.1 compatible), with `.claude/` remaining local and generated — the
local/tracked boundary PR #30 drew is preserved; the hook *design* is now version-controlled,
reviewable, and reproducible on another machine.

The verify script's first run on this workstation immediately paid for itself: PowerShell 5.1
pipes prepend a UTF-8 BOM to native-command stdin, which `json.load` rejects — so
`pre_bash_guard.py` failed **open** (a guard silently not guarding). All three hooks now decode
stdin as `utf-8-sig`; the smoke test that caught it is part of `verify-hooks.ps1`, so any host
with BOM-emitting pipes re-tests the case on every verification run.
56 changes: 56 additions & 0 deletions tools/claude-hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Claude Code Hooks — Tracked Canonical Source

This directory is the version-controlled source of truth for Continuum's Claude Code hooks.
The live runtime state under `.claude/` is **generated and gitignored** (`.gitignore` keeps
`.claude/*` private except `.claude/skills/`) — never edit installed copies directly; edit the
sources here and re-run the installer. This boundary is deliberate: hook *design* is reviewable
project infrastructure, hook *installation* is local machine state.

Why tracked: the original PR #30 scaffold hooks lived only as local files and were nearly lost
(see `docs/scaffold_hooks_reconstruction_note.md` — the 2026-07-23 laptop crash is exactly the
failure mode that erases local-only process controls). Anything that shapes how Continuum is
developed must survive a dead workstation.

## Layout

```
tools/claude-hooks/
README.md this file
hooks/ canonical hook scripts + settings template
pre_bash_guard.py PreToolUse(Bash): blocks rm -rf / git push --force, exit 2
post_edit_tests.py PostToolUse(Write|Edit): pytest -k <stem> for pi_script/rift/moltbook edits
stop_suite_notify.py Stop: full suite + Discord PASS/FAIL notify (notify-only, never blocks)
settings.template.json the .claude/settings.json wiring for the three hooks
schemas/ stdin JSON contract each hook consumes (documentation schemas)
install-hooks.ps1 copies hooks + settings into .claude/ (Windows PowerShell 5.1)
verify-hooks.ps1 proves installed state matches source and hooks actually fire
```

## Install

```powershell
powershell -ExecutionPolicy Bypass -File tools\claude-hooks\install-hooks.ps1
```

Re-run any time the tracked sources change. If your `.claude/settings.json` has local
customizations the installer refuses to clobber them — merge the `hooks` block manually or
re-run with `-Force` (a timestamped backup is kept).

## Verify

```powershell
powershell -ExecutionPolicy Bypass -File tools\claude-hooks\verify-hooks.ps1 # fast
powershell -ExecutionPolicy Bypass -File tools\claude-hooks\verify-hooks.ps1 -Full # + real full-suite Stop-hook run
```

## Hook interface notes

- Hooks receive a JSON payload on **stdin** (current Claude Code interface — the old
`CLAUDE_FILE_PATH`/`CLAUDE_TOOL_INPUT` env vars from the PR #30-era scaffold no longer exist).
`schemas/` documents exactly which fields each hook consumes.
- Exit code 2 blocks (PreToolUse) or feeds stderr back to the model (PostToolUse). The Stop
hook is notify-only and always exits 0 by design.
- `DISCORD_WEBHOOK_URL` (optional, never committed): enables the Stop hook's Discord
notification. Unset, the suite still runs and the result is printed to the transcript.
- Scripts are invoked as `python .claude/hooks/<name>.py` with the project directory as cwd —
shell-agnostic (works under both cmd and POSIX-shell hook execution), no jq/bash dependency.
54 changes: 54 additions & 0 deletions tools/claude-hooks/hooks/post_edit_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""PostToolUse hook for Write|Edit: run targeted tests for core-package edits.

Port of the scaffold's v2 hook: when a .py file under pi_script/, rift/, or
moltbook/ is written or edited, run `pytest -k <stem> -q` (the scaffold's
deliberate approximation of "run related tests" — README_SETUP.md notes it
is blunt by design). Exit 2 on test failure so the failures are fed back to
the model; exit 0 when no tests match (pytest exit 5) or the file is out of
scope.
"""
import json
import pathlib
import subprocess
import sys

WATCHED = ("pi_script", "rift", "moltbook")


def main() -> int:
try:
# utf-8-sig tolerates the BOM PowerShell 5.1 pipes prepend
payload = json.loads(sys.stdin.buffer.read().decode("utf-8-sig"))
except (json.JSONDecodeError, ValueError):
return 0
file_path = (payload.get("tool_input") or {}).get("file_path", "")
if not file_path or not file_path.endswith(".py"):
return 0
project_dir = pathlib.Path(payload.get("cwd") or ".").resolve()
try:
rel = pathlib.Path(file_path).resolve().relative_to(project_dir)
except ValueError:
return 0 # edited file lives outside the project
if rel.parts[0] not in WATCHED:
return 0
stem = pathlib.Path(file_path).stem
result = subprocess.run(
[sys.executable, "-m", "pytest", "-k", stem, "-q"],
cwd=project_dir,
capture_output=True,
text=True,
timeout=110,
)
if result.returncode in (0, 5): # 5 = no tests matched the -k expression
return 0
tail = "\n".join((result.stdout or "").splitlines()[-30:])
print(
f"pytest -k {stem} failed (exit {result.returncode}) after editing "
f"{rel}:\n{tail}",
file=sys.stderr,
)
return 2


if __name__ == "__main__":
sys.exit(main())
35 changes: 35 additions & 0 deletions tools/claude-hooks/hooks/pre_bash_guard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""PreToolUse guard for Bash: block destructive commands deterministically.

Port of the scaffold's v2 hook (settings.example.json, PR #30 era) to the
current Claude Code hook interface: input arrives as JSON on stdin, exit
code 2 blocks the tool call and feeds stderr back to the model.
"""
import json
import re
import sys

BLOCKED = re.compile(r"rm -rf|git push --force|git push -f\b")


def main() -> int:
try:
# utf-8-sig: PowerShell 5.1 pipes prepend a BOM, which json.load rejects —
# and a guard that fails open on that is silently not guarding.
payload = json.loads(sys.stdin.buffer.read().decode("utf-8-sig"))
except (json.JSONDecodeError, ValueError):
return 0 # malformed input: never block on our own parse failure
command = (payload.get("tool_input") or {}).get("command", "")
match = BLOCKED.search(command)
if match:
print(
f"Blocked by .claude/hooks/pre_bash_guard.py: command contains "
f"'{match.group(0)}'. Destructive commands require the operator "
f"to run them manually.",
file=sys.stderr,
)
return 2
return 0


if __name__ == "__main__":
sys.exit(main())
39 changes: 39 additions & 0 deletions tools/claude-hooks/hooks/settings.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "python .claude/hooks/pre_bash_guard.py",
"timeout": 10
}
]
}
],
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "python .claude/hooks/post_edit_tests.py",
"timeout": 120
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "python .claude/hooks/stop_suite_notify.py",
"timeout": 300
}
]
}
]
}
}
Loading
Loading