feat(substrate): auto-run in Claude Code, harden prototype, slim package, pro docs#10
Conversation
…age, pro docs - Ambient auto-use: UserPromptSubmit hook injects the full substrate advisory (assumption gate + routing + blast radius + memory + verify) when it matters, silent otherwise. Load-only, fail-safe, never writes .forge/ from a hook. - Cross-tool auto-use: source/rules.json substrate section emits the run-before- risky-work rule into every tool config via forge init. - Security: drop pickle cache in impact_oracle world_model (RCE via caller-supplied cache_dir); JSON node-link only + cache_dir containment. - Package: stop publishing docs/cognitive-substrate (~2MB); remove redundant zips (source lives unzipped in research/). npm tarball ~2.3MB -> 282KB. - Perf: substrateCheck no longer recomputes the assumption assessment. - Docs: professional example-rich cognitive-substrate guide; README consolidated.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e47df0c64
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const worthSaying = | ||
| result.assumption.shouldAsk || | ||
| result.impact.impactedFiles.length > 0 || | ||
| result.minimality.warnings.length > 0 || | ||
| ["opus", "fable"].includes(result.route.key); |
There was a problem hiding this comment.
Include unresolved references in the ambient advisory
In the Claude UserPromptSubmit flow I checked (cortex_hook_main.js calls substrateContext(substrateCheck(...))), a prompt that names a missing symbol/file can produce a nonempty clarify block while assumption.shouldAsk stays false; if there is no impact/minimality/premium signal, this predicate returns "" and the hook emits nothing. The previous hook emitted clarifyBlock, so clear tasks that name nonexistent code now silently bypass the repo-grounding warning; include the unresolved preflight/result.clarify signal in this predicate/output.
Useful? React with 👍 / 👎.
| if os.path.commonpath([resolved, self.root]) != self.root: | ||
| raise ValueError( | ||
| f"cache_dir {cache_dir!r} must be inside root {self.root!r}" | ||
| ) |
There was a problem hiding this comment.
Keep documented prototype caches working
The documented prototype entry points still construct WorldModel with /tmp/impact_oracle_demo_cache and /tmp/impact_oracle_eval_cache, which are outside the demo_package root. With this new containment check, python demo.py and evaluate.py raise ValueError before building the world model, so the shipped reproducibility commands break unless those callers are updated to use an in-root cache or a safe external-temp exception is preserved.
Useful? React with 👍 / 👎.
CI's floating @biomejs/biome ^2.0.0 resolved to 2.5.2 while biome.json's schema stayed 2.0.0 — the mismatch hard-failed `biome check`. Pin the exact version (matches the repo's pinning ethos) and bump the schema URL to 2.5.2; reformat.
(assumption gate + routing + blast radius + memory + verify) when it matters,
silent otherwise. Load-only, fail-safe, never writes .forge/ from a hook.
risky-work rule into every tool config via forge init.
cache_dir); JSON node-link only + cache_dir containment.
(source lives unzipped in research/). npm tarball ~2.3MB -> 282KB.