Skip to content

feat: science projects inherit the PyAuto* API code-gate via refer-back#48

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/science-project-api-gate
Jul 10, 2026
Merged

feat: science projects inherit the PyAuto* API code-gate via refer-back#48
Jammy2211 merged 1 commit into
mainfrom
feature/science-project-api-gate

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Closes #47.

Summary

Generated science projects now ship the assistant's PyAuto* API code-gate via refer-back: start-new-project scaffolds a thin .claude/settings.json whose PreToolUse(Bash) hook resolves the assistant at runtime ($AUTOLENS_ASSISTANT → sibling ../autolens_assistantsources/autolens_assistant) and execs the assistant's validate_pyauto_code.py. The validator stays in one place (validate_pyauto_code.py resolves audit_skill_apis.py relative to itself) — the project vendors nothing and bakes in no absolute paths. On by default, fail-open: no assistant clone → silent allow. The generated AGENTS.md template gains a "Code gate" section with the cross-tool caveat (only Claude Code runs .claude/ hooks; Codex/Gemini/chat self-enforce with audit_skill_apis.py --code/--file).

Strengthens the fork-and-continue story from #45: a collaborator who clones a project inherits the same code-grounding protection.

Scripts Changed

None — documentation/scaffold-template only (skills/start-new-project.md).

Validation

Scratch project with the exact generated settings.json, fake PreToolUse payloads:

  • dead symbol (al.FitImagingPlotter) + assistant via $AUTOLENS_ASSISTANTdeny with the gate report
  • dead symbol + assistant via sibling resolution → deny
  • dead symbol, no assistant resolvable → exit 0 silent allow (fail-open)
  • valid symbol (al.Tracer) → allow (no output)
  • --check-citations: 90 files, 388 citations, 0 missing, 0 warnings

Readiness

Heart YELLOW on the standing 6-reason set only (human-acked repeatedly 2026-07-10); docs-only, not on the library release train.

🤖 Generated with Claude Code

…ck (#47)

The Create scaffold now generates a thin .claude/settings.json whose
PreToolUse(Bash) hook resolves the assistant at runtime ($AUTOLENS_ASSISTANT
-> sibling -> sources/ clone) and execs the assistant's
validate_pyauto_code.py — nothing vendored, no absolute paths, on by default
and fail-open when no assistant clone resolves. The generated AGENTS.md gains
a Code gate section with the cross-tool caveat (hooks are Claude Code-only;
other harnesses self-enforce via audit_skill_apis.py --code/--file).

Validated end-to-end: deny on dead symbol via env-var and sibling resolution,
allow on valid symbol, silent fail-open with no assistant.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 65f9598 into main Jul 10, 2026
1 check failed
@Jammy2211
Jammy2211 deleted the feature/science-project-api-gate branch July 10, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: science projects inherit the PyAuto* API code-gate via refer-back

1 participant