838b5ae216
Update root + 43 directory-level AGENTS.md files to reflect current state: - Root AGENTS.md rewritten with accurate counts (1967 TS files, 1304 source + 663 test, 278k LOC, 120 barrel index.ts), 7-step init flow, 5-tier hook composition, and full Team Mode section (12 team_* tools, eligibility, storage layout, config gate) - src/AGENTS.md adds team-mode init step, current per-subdir file/LOC table - src/tools/AGENTS.md documents conditional gates (team-mode +12, task system +4, hashline +1, interactive_bash +1, look_at +1) with always-on baseline of 20 - src/hooks/AGENTS.md splits into 5 tiers + 4 conditional team-mode hooks - src/features/team-mode/AGENTS.md surfaces 12 tools, eligible agents, spawn-race-safe invariants, and integration points - src/features/builtin-skills/AGENTS.md tracks 10 skills incl. team-mode - src/agents/AGENTS.md, src/plugin/AGENTS.md, src/config/AGENTS.md updated for team-mode awareness, accurate counts, and current schema field list - All other AGENTS.md files refreshed to 2026-05-08 generation date
2.0 KiB
2.0 KiB
src/hooks/comment-checker/ — AI Slop Comment Blocker
Generated: 2026-05-08
OVERVIEW
Tool Guard tier hook. Runs after write/edit tools to detect AI-generated comment patterns in code and block them before they land. Backed by @code-yeongyu/comment-checker binary (trusted dependency).
WHAT IT BLOCKS
AI slop comment smells:
- Restating what code literally does (
// increment counter) - Filler phrases (
// obviously,// clearly,// simply) - Decorative separators without purpose
- JSDoc on trivially-named functions
// TODO:without context- Comments contradicting surrounding code
See @code-yeongyu/comment-checker for the authoritative blocklist.
EXECUTION FLOW
tool.execute.after (write | edit | hashline edit)
→ extract changed lines from tool output
→ spawn comment-checker binary with changed file path
→ parse findings (line ranges + violation category)
→ if findings → inject tool-level error → agent must fix
KEY FILES
| File | Purpose |
|---|---|
hook.ts |
createCommentCheckerHook() — main factory, tool.execute.after handler |
comment-checker-runner.ts |
Spawn binary, parse JSON output |
changed-line-extractor.ts |
Extract which lines changed from tool result |
findings-formatter.ts |
Format violations as actionable error message |
binary-resolver.ts |
Locate comment-checker binary (node_modules + PATH) |
CONFIG
// oh-my-opencode.jsonc
{
"comment_checker": {
"enabled": true, // default: true
"severity": "error" // error blocks, warning notifies only
}
}
Disable via "disabled_hooks": ["comment-checker"].
BYPASS FOR LEGITIMATE COMMENTS
Prefix with // @allow or mark file scope with // comment-checker-disable-file at top. Use sparingly — defeating the purpose.
RELATED
- Doctor check:
src/cli/doctor/checks/tools.tsverifiescomment-checkerbinary availability - Postinstall:
postinstall.mjsdownloads binary if missing