claude-forge-smith / hooks
AGENTS.md2 starsChanged 10 months agoMITView on GitHub
Claude Code hook scripts that integrate Forge into the tool lifecycle. Implements lazy detection (only scanning on Write/Edit), session management, and skill usage tracking.
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude-plugin/AGENTS.mdAGENTS.md
- config/AGENTS.mdAGENTS.md
- data/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- examples/AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- .github/ISSUE_TEMPLATE/AGENTS.mdAGENTS.md
- .github/workflows/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- skills/AGENTS.mdAGENTS.md
- skills/forge/AGENTS.mdAGENTS.md
- skills/monitor/AGENTS.mdAGENTS.md
- skills/smelt/AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- forgeSkill
- monitorSkill
- smeltSkill
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
All hooks must output valid JSON: {"continue": true} or {"continue": false}
- Very specific: line 32
Use debug_log for stderr logging when SKILL_EVAL_DEBUG=true
- Distinctive: line 36
Test hooks with sample JSON input via stdin
- Distinctive: line 37
Verify JSON output format
- Distinctive: line 38
Check exit codes (0 for success)
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- Parent: ../AGENTS.md --><!-- Generated: 2026-01-31 | Updated: 2026-01-31 -->hooks
Purpose
Claude Code hook scripts that integrate Forge into the tool lifecycle. Implements lazy detection (only scanning on Write/Edit), session management, and skill usage tracking.
Key Files
| File | Description |
pre-tool.sh | PreToolUse hook - records skill invocation start time |
post-tool.sh | PostToolUse hook - records skill completion and metrics |
session-start.sh | Session initialization hook |
session-stop.sh | Session cleanup hook |
user-prompt.sh | User prompt submission hook |
Subdirectories
| Directory | Purpose |
lib/ | Shared shell library functions (see lib/AGENTS.md) |
For AI Agents
Working In This Directory
- All hooks must output valid JSON:
{"continue": true}or{"continue": false} - Source
lib/common.shat the top of each hook - Use
debug_logfor stderr logging whenSKILL_EVAL_DEBUG=true
Testing Requirements
- Test hooks with sample JSON input via stdin
- Verify JSON output format
- Check exit codes (0 for success)
Common Patterns
#!/bin/bash
source "$(dirname "$0")/lib/common.sh"
INPUT=$(cat)
# ... process INPUT ...
echo '{"continue": true}'Dependencies
Internal
lib/- All shared functions../config/settings.env- Configuration values
External
jq- JSON processing (optional, fallback to grep/sed)date- Timestamp generation
<!-- MANUAL: -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

