decode_tools / docs /guides /ai-enablement-limits.md
DecodeMarketing's picture
[ai-standards][slice-3] agent contracts and audit traceability (shrunk) (#10)
2509f31 unverified
|
Raw History Blame Contribute Delete
5.61 kB
# AI enablement limits
Where AI agents working in this repo are intentionally constrained.
This is the human-readable counterpart to the executable enforcement that
lives in `.claude/hooks/`, `.githooks/`, and `CLAUDE.md`. The hooks block;
this document explains *why* and *what to do when blocked*.
## What is intentionally limited
### 1. Destructive git operations
Blocked by `.claude/hooks/block-dangerous-git.sh`:
- `git push --force` (any variant, including `--force-with-lease`)
- `git reset --hard`
- `git clean -f`
- `git branch -D`
- Other destructive variants
**Why:** Recoverable mistakes cost minutes; an unintended force-push to
`main` propagates to HF Spaces as a rewritten deploy history and can lose
work shared by the team. The hook errs on the side of asking the human.
**When you genuinely need one:** explain in chat what you need to do and
why, get explicit user confirmation, and have the user run the command
themselves in a plain terminal. The agent does not bypass the hook.
### 2. Writes to secret files
Blocked by `.claude/hooks/block-env-writes.sh`:
- `.env`, `.env.local`, `.env.production`, etc.
- `credentials*`
- `*.pem`, `*.key`
- `id_rsa`, `id_ed25519`, other SSH key patterns
**Why:** Secrets must not enter the working tree where they could be
accidentally committed. `.env.example` (committed; comment-only; no real
values) is an exception and is allowed.
**When you legitimately need to read an env var:** read it from
`os.environ` at runtime, not from a file the agent writes. For deploy
secrets, use GitHub Actions secrets and the workflow's environment;
`HF_TOKEN` follows this pattern (see `SECURITY.md`).
### 3. Modifications to the deploy-critical surface
Constrained by social convention (documented in
`docs/guides/protected-boundary-policy.md`), not by hooks:
- `app.py`, `helper.py`, `tab1.py`–`tab8.py` (application code)
- `requirements.txt`, `runtime.txt` (HF Spaces dependency declaration)
- `.streamlit/` (Streamlit config)
- `.devcontainer/` (Codespaces config)
- `.github/workflows/main.yml` (HF deploy pipeline)
- `CLAUDE.md` (DECODE base rules)
An agent CAN technically edit these files. The convention is to NOT do so
inside an audit / remediation slice without naming the file in the slice's
scope. Doing so anyway will be caught at review time and unwound.
### 4. Commits without reviewer subagent approval
Enforced by `.githooks/commit-msg` (matched against `.decode-reviewer-clean`
hash, or by the explicit `[override-reviewer: <reason>]` trailer):
The `feature-dev:code-reviewer` subagent must approve any change to
"substantive files" before commit. The current definition lives in
`CLAUDE.md`. The marker is gitignored and session-local β€” every change set
gets a fresh review.
**When you legitimately need to override:** add
`[override-reviewer: <reason>]` to the commit message. The override is
visible forever in `git log --grep="override-reviewer"` and is audited by
the `override-audit` CI job. Use sparingly β€” for truly trivial cases like
fixing a typo in a doc.
### 5. AI attribution in commit messages
No `Co-Authored-By: Claude ...`, no "Generated by Claude Code", no robot
emoji in subject lines.
**Why:** DECODE base rule 5. Commits should look like a human wrote them.
The reviewer marker + override audit already create an unambiguous trail
of which commits went through the AI workflow; the commit message itself
stays conventional.
**Slip recovery:** if an AI-attribution trailer accidentally landed on a
merged commit (as happened on PR #7 / commit `7a5c442` during the slice-1
work), accept it. Do not force-push or revert just to clean it up β€” the
disruption is larger than the violation. Memory + this doc are how we
prevent repeats.
### 6. Generated artifacts at the repo root
Constrained by `docs/policies/root-artifact-policy.md` (intent) and
`.gitignore` (partial enforcement):
`__pycache__/`, `*.pyc`, `.decode-reviewer-clean`, `.decode-reviewer-findings.md`
are gitignored. `.ruff_cache/`, `.pytest_cache/`, `.venv/`, `.coverage` are
tolerated locally but should never appear in `git status` as untracked
candidates for staging.
## What is intentionally NOT limited
The agent IS allowed to:
- Read any file in the repo (no read-side restrictions).
- Author or modify files under `docs/`, `scripts/`, `AGENTS.md`,
`SECURITY.md`, `.env.example`, `pyproject.toml`, `.python-version`,
`requirements.lock`, and new files under `.claude/manifests/` or
`.claude/skills/<new-skill>/`.
- Run the local validator (`python scripts/repo_validate.py`) without
asking β€” it's read-only.
- Run `streamlit run app.py` for local verification β€” it's read-only at
the file-system level (the app's tempdir use is sandboxed by Streamlit).
- Open pull requests via `gh pr create` (with `--base main` explicitly).
## Where these limits are codified
| Layer | What | File |
|---|---|---|
| Executable | hook scripts | `.claude/hooks/block-*.sh`, `.githooks/commit-msg`, `.githooks/pre-commit` |
| Executable | reviewer subagent contract | `CLAUDE.md` reviewer procedure |
| Documentary | this file | `docs/guides/ai-enablement-limits.md` |
| Documentary | deploy-boundary rules | `docs/guides/protected-boundary-policy.md` |
| Documentary | reviewer workflow | `docs/guides/review-workflow.md` |
| Documentary | DECODE base rules | `CLAUDE.md` (sections 1–5) |
| Documentary | this audit's posture | `.claude/manifests/standards-sync.yaml` |
When a hook blocks an agent, the agent should consult this document for
the human-readable rationale before deciding to ask the user for an
override.