Skip to content

M62 (TASK-119-FREE): Injection-Safe SKILL.md & Non-TTY Safe verity init

1. Purpose & Architectural Decisions

  • Problem (P1.1): verity scan --skills already scans SKILL.md, yet verity init ships no SKILL.md — forcing coding agents to burn tokens guessing CLI flags — and interactive prompts can stall CI/agent harnesses.
  • Non-TTY Fail-Safe: verity init auto-detects !sys.stdin.isatty() and supports --yes / -y; it never blocks on stdin reads when non-interactive or --yes is supplied.
  • Minimal Deterministic Scaffolding: verity.toml, .verityignore, .agents/policies.yaml, and .agents/skills/verity-security/SKILL.md (opt-out via --no-skill).
  • Additive-Only Writes: AGENTS.md and CLAUDE.md remain byte-for-byte untouched unless --update-agents-md is explicitly passed.
  • Self-Cleaning Skill Template: the shipped SKILL.md template is 100% deterministic, concise, free of hidden Unicode/ANSI/injection patterns, and passes InstructionFileScanner + StaticRuleEvaluator with zero findings.
  • Free/Open-Core Boundary: pure Open-Core onboarding in verityredteam-free, zero Pro dependencies.

2. Target Files

File Change
src/verity/onboarding/wizard.py Add non-TTY/--yes short-circuit via !sys.stdin.isatty(), write minimal scaffolding, add --no-skill / --update-agents-md handling, leave AGENTS.md/CLAUDE.md untouched by default
src/verity/onboarding/skill_template.py (or template constant in wizard.py) Ship deterministic injection-safe .agents/skills/verity-security/SKILL.md template
src/verity/cli.py Extend verity init argument surface (--no-skill, --update-agents-md, --yes/-y wiring)
tests/unit/test_init_skill_and_non_tty.py Unit tests for non-TTY short-circuit, --no-skill, additive-only writes, and template cleanliness

3. ATDD Traceability Matrix

AC ID Acceptance Criterion Paired Benign / Negative Control Verification Tier Test Target
AC-62.1 verity init with non-TTY stdin (or --yes) completes immediately with zero blocking reads and scaffolds verity.toml, .verityignore, .agents/policies.yaml, and .agents/skills/verity-security/SKILL.md. Benign: explicit --yes produces the same artifact set as the non-TTY default path. unit tests/unit/test_init_skill_and_non_tty.py::test_init_non_tty_never_blocks_and_scaffolds_skill
AC-62.2 --no-skill skips writing .agents/skills/verity-security/SKILL.md; AGENTS.md and CLAUDE.md remain byte-for-byte unchanged unless --update-agents-md is supplied. Benign: pre-existing AGENTS.md/CLAUDE.md hash-identical after default run; --update-agents-md then produces a documented append. unit tests/unit/test_init_skill_and_non_tty.py::test_init_no_skill_and_agent_files_untouched
AC-62.3 Scanning the generated SKILL.md with InstructionFileScanner and StaticRuleEvaluator yields zero findings (paired negative control: injected SKILL.md triggers VERITY-STATIC-INJECTION-OVERRIDE). Negative control: SKILL.md containing "ignore previous instructions" emits VERITY-STATIC-INJECTION-OVERRIDE. unit tests/unit/test_init_skill_and_non_tty.py::test_init_skill_md_clean_and_injection_control_flagged
AC-62.4 Ruff linter and full unit test suite pass cleanly. Clean workspace yields zero lint errors. ruff uv run ruff check src tests && uv run pytest tests/

4. Verification Commands

uv run pytest tests/unit/test_init_skill_and_non_tty.py
uv run pytest tests/
uv run ruff check src tests

5. Execution Checklist

  • [ ] AC-62.1 implemented (non-TTY/--yes short-circuit + minimal scaffolding)
  • [ ] AC-62.2 implemented (--no-skill, additive-only AGENTS.md/CLAUDE.md)
  • [ ] AC-62.3 implemented (injection-safe SKILL.md template + negative control)
  • [ ] AC-62.4 verified green (ruff + full pytest)
  • [ ] Board #5 item PVTI_lAHOD-xmQM4Br351zhOMDk4 synced & status updated