Add AI coding agent instruction files and hook architecture#142
Merged
Add AI coding agent instruction files and hook architecture#142
Conversation
- AGENTS.md as single source of truth for AI assistant context - CLAUDE.md as thin @AGENTS.md import for Claude Code - .claude/settings.json with shared permissions and hook wiring - .claude/hooks/session-start.sh to install deps on session start - .claude/hooks/post-edit-lint.sh for fast per-file linting - .claude/hooks/post-stop-validate.sh for full lint, test, and build
Ignore plans, todos, local settings, and worktrees from Claude Code and data directories from Cursor, Aider, Codeium, Copilot, Windsurf, Cline, and Codex. Shared config (.claude/settings.json, hooks) remains tracked.
pkopac
approved these changes
Apr 16, 2026
- SessionStart: detect repo state (branch, dirty files, missing deps) instead of running pip install. No network, <1s, idempotent. - PostToolUse: record edited file path only (<50ms). No linting per edit - batched to Stop instead. - Stop: batch-lint touched files with flake8, run test suite (~0.13s). Report lint issues and test failures as additionalContext so the next turn sees them. Silent on clean runs. - Add MultiEdit to PostToolUse matcher in settings.json.
- Add session-scoped file tracker via CLAUDE_ENV_FILE to prevent cross-session collisions (matches Ruby SDK approach) - Rename session-start.sh to session-start-setup.sh for consistency - Fix python -> python3 usage throughout all hooks - Fix double git status call in session start - Run tests unconditionally in Stop (0.13s cost, catches regressions even when only Bash commands were used) - Extract structured lint offenses and test failure summaries instead of raw output - Align .gitignore AI tool entries with Ruby SDK (add .claude/memory, scheduled-tasks, credentials.json, CLAUDE.local.md, .continue, .junie, granular .cursor paths)
loomchild
reviewed
Apr 16, 2026
loomchild
left a comment
There was a problem hiding this comment.
LGTM, just 2 random comments. But I am not really qualified to test since I am not using these tools much.
pkopac
reviewed
Apr 16, 2026
- .gitignore: use .claude/* with negation for hooks/ and settings.json instead of listing individual subdirs. Use .cursor/ instead of individual subdirs. (loomchild) - AGENTS.md: remove Python version and CI mention from testing section - tools can read version from setup.py/CI config (loomchild) - settings.json: remove gh api from default allow list (pkopac)
.cursor/rules/ can be committed for shared project rules, so only ignore ephemeral subdirs (chat/, composer/) and local config (mcp.json).
pkopac
approved these changes
Apr 16, 2026
Replace broad Bash(gh pr:*) with granular read-only rules: - gh pr view/list/diff/checks/status - gh run view/list/watch - gh issue view/list - gh release view/list - gh repo view - gh search Write operations (gh pr create/edit/merge, gh api POST) will now prompt for confirmation instead of running automatically.
- session-start-setup.sh: read session_id from hook input JSON instead of generating a custom one - Move file tracker from /tmp to .claude/tmp/ (already gitignored by .claude/* rule) so hooks don't write outside the project directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AGENTS.mdas single source of truth for AI coding assistant context (Cursor, Copilot, Windsurf, Codex, Cline all read it natively)CLAUDE.mdas a thin@AGENTS.mdimport for Claude Code.claude/with permissions and three hooks tuned for speed.gitignorerules for ephemeral AI tool data while keeping shared config trackedHooks
session-start-setup.shCLAUDE_ENV_FILE. Reports git branch, dirty files, missing deps (import chartmogul). Local-only, no network.post-edit-lint.sh.pyfile path to a session-scoped tracker. Deduplicates inline withsort -u. Skips__pycache__/,*.egg-info/,dist/,build/, non-Python. No formatting.post-stop-validate.shDesign decisions
CLAUDE_ENV_FILE) so concurrent sessions on the same machine don't collideCLAUDE_ENV_FILEsession ID mechanism, same structuredjqoutput formatTest plan
CLAUDE.mdresolves the@AGENTS.mdimport.claude/settings.local.jsonis gitignored but.claude/settings.jsonis tracked.pyfile and verify the edit completes instantly (no lint delay)