teamem / hooks
AGENTS.md1 starsChanged 6 months agoApache-2.0View on GitHub
Top-level directory for Claude Code and Codex lifecycle hooks. These are standalone bash scripts that fire during agent session events (session start, pre-tool-use, post-tool-use, on-before-edit, on-after-edit, etc.). Each hook publishes a Teamem event to track agent progress and coordination. Note: This directory contains raw hook scripts. The plugin's hooks manifest lives separately in plugin/hooks/hooks.json and references these scripts. For local development, hooks can also be registered in .claude/settings.json. (None — subdirectories contain all hooks.)
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 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 repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- plugin/AGENTS.mdAGENTS.md
- plugin-e2e-module/AGENTS.mdAGENTS.md
- src/AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- rddSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 34
Test hooks locally by setting TEAMEM_SERVER_URL, TEAMEM_BEARER_TOKEN, TEAMEM_PRINCIPAL, and running the script manually.
- Very specific: line 35
Verify no network errors in ~/.cache/teamem/hook-errors.log.
- Very specific: line 40
All hooks follow the same error-handling pattern: log to hook-errors.log on network/auth failure, then exit 0 (fail-open).
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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-05-09 | Updated: 2026-05-09 -->hooks
Purpose
Top-level directory for Claude Code and Codex lifecycle hooks. These are standalone bash scripts that fire during agent session events (session start, pre-tool-use, post-tool-use, on-before-edit, on-after-edit, etc.). Each hook publishes a Teamem event to track agent progress and coordination.
Note: This directory contains raw hook scripts. The plugin's hooks manifest lives separately in plugin/hooks/hooks.json and references these scripts. For local development, hooks can also be registered in .claude/settings.json.
Subdirectories
| Directory | Purpose |
claude/ | Claude Code lifecycle hooks (session-start, pre-tool-use, post-tool-use) |
codex/ | Codex lifecycle hooks (on-before-edit, on-after-edit, on-task-start) |
Key Files (at this level)
(None — subdirectories contain all hooks.)
For AI Agents
Working In This Directory
- Each hook script is self-contained and should
exit 0(always succeeds, even on error) to avoid blocking the agent harness. - Hooks use curl to POST events to the Teamem server at
TEAMEM_SERVER_URL(default: http://localhost:3000). - Authentication is via
TEAMEM_BEARER_TOKEN(environment variable). - Errors are logged to
${HOME}/.cache/teamem/hook-errors.log(JSON format) rather than stderr.
Testing Requirements
- Test hooks locally by setting
TEAMEM_SERVER_URL,TEAMEM_BEARER_TOKEN,TEAMEM_PRINCIPAL, and running the script manually. - Verify no network errors in
~/.cache/teamem/hook-errors.log. - The server must be running and accessible at the configured URL.
Common Patterns
- All hooks follow the same error-handling pattern: log to
hook-errors.logon network/auth failure, thenexit 0(fail-open). - Event bodies are JSON and include
repo_id,principal,actor,delegation,event_type, and a type-specificpayload. - Hooks are optional — the coordination system works without them, but agents lose progress visibility.
Dependencies
Internal
src/server/routes.ts— accepts POST to/tools/*with Bearer auth- Environment variables:
TEAMEM_SERVER_URL,TEAMEM_BEARER_TOKEN,TEAMEM_PRINCIPAL,TEAMEM_ACTOR,TEAMEM_DELEGATION,TEAMEM_REPO_ID,TEAMEM_TASK_ID(Codex only)
External
curl— HTTP clientdate— timestamp generation
<!-- MANUAL: hooks/ contains raw scripts; plugin/hooks/hooks.json registers them for the plugin. .claude/settings.json can also register these for local dev. -->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.

