AgentApropos::Init
Constants
AGENTS_SKELETON = "# Project\n\n<!-- Layer 1: universal, always-loaded rules. Keep this tight — a bloated\n root file gets skimmed. Scoped guidance belongs in docs/conventions/. -->\n\n## Commands\n\n## Universal rules\n\n## Where scoped guidance lives\n\nTask- and file-scoped conventions are **not** in this file. They live in\n`docs/conventions/` and are surfaced automatically at edit time by agent-apropos's\nhooks. See `docs/conventions/README.md`."
CACHE_IGNORE_ENTRY = ".cache/agent-apropos/"
CONVENTIONS_README = "# Conventions\n\nThis directory is the single source of truth for scoped guidance — the\njudgment calls a linter or formatter cannot enforce. It implements the Agent\nDocumentation Structure Standard. Universal, always-apply rules live in the\nroot `AGENTS.md`; anything a tool can enforce lives in that tool.\n\n## The three layers\n\n| Layer | For | Trigger | Delivered by |\n| --- | --- | --- | --- |\n| 1 Root file | Universal rules | Always loaded | `AGENTS.md` |\n| 2 Scoped rules | Guidance for a path, an API / construct, or both | A **write** to a matching **path** and/or matching written **content** (regex) | Pre/PostToolUse hooks |\n| 3 Intent skills | Task-nature guidance | Skill match | Generated `.claude/skills/*/SKILL.md` |\n\n## Frontmatter\n\n```yaml\n---\npaths: [\"src/**\"] # inject when writing to a matching path\ncontents: ['\\bTODO\\b'] # inject when written code matches (PCRE2)\nskill: true # Layer 3: generate a skill wrapper\ndescription: \"Use when ...\" # required iff skill: true; must start with \"Use when\"\n---\n```\n\n- `paths` only → fires on any write to a matching path\n- `contents` only → fires when written code matches, anywhere\n- `paths` + `contents` → **AND**: both must match\n- `skill: true` is independent and may combine with either\n- no frontmatter → reference-only: reachable by link, never triggered\n\nRules are injected only when the agent **writes**. A read injects nothing;\nit only tells agent-apropos that a convention doc is already in the model's\ncontext, so no later write re-injects it. That needs a read that both\ncompleted and covered the whole doc, so read tools are wired on the\npost-execution event and a partial (offset/limit) read is ignored.\n\n## Writing a rule\n\n- One concern per file; keep it short — tight rules get read, long ones get skimmed.\n- State **what** the rule is, **why** it exists, and a verification criterion.\n- Add an optional `## Verify` heading; `agent-apropos review` harvests it as a checklist item.\n\nClaude Code delivers via PreToolUse `additionalContext`; run\n`agent-apropos doctor` to verify the version. OpenCode delivers via\n`tool.execute.before` and `tool.execute.after`, injecting context with\n`noReply: true` through the generated plugin. Gemini CLI and GitHub\nCopilot CLI both have no pre-edit context-injection event (Gemini's\n`BeforeTool` and Copilot's `preToolUse` can only override arguments or\nblock/allow the call), so they deliver via their post-edit hook instead\n(`AfterTool` for Gemini, `postToolUse` for Copilot) — rules still fire,\njust after the edit rather than before it. Codex CLI's own PreToolUse\n*can* inject context, so it delivers the same way Claude Code does; its\n`apply_patch` tool can bundle several files' edits into one call, which\nagent-apropos matches and injects per file."
EXAMPLE_L2 = "---\npaths: [\"src/**\"]\n---\n\n# Source files\n\nKeep modules small and single-purpose. This is an example path-scoped rule: it\nis injected whenever a file under `src/` is written. Replace it with a real\nconvention or delete it.\n\n## Verify\n\n- The change keeps one concern per file."
EXAMPLE_L3 = "---\ncontents: ['\\bTODO\\b']\n---\n\n# Leftover TODOs\n\nThis is an example content-scoped rule: it is injected when written content\nmatches the `contents` regex (here, a stray `TODO`). Replace it with a real\nconstruct-scoped convention or delete it."
EXAMPLE_SKILL = "---\nskill: true\ndescription: \"Use when shipping a change end to end\"\n---\n\n# Shipping a change\n\nThis is an example intent-skill doc. `agent-apropos generate` turns it into a\n`.claude/skills/example-skill/SKILL.md` wrapper. Replace it with a real\nworkflow or delete it."
KNOWN_TOOLS = Agents.names
NEXT_STEPS_HINT = "next have your agent bootstrap docs/conventions/ from your existing docs — see https://github.com/NEXL-LTS/agent-apropos#bootstrapping-from-an-existing-codebase"
SKILLS_GITKEEP = "# Generated skill wrappers live here.\n#\n# `agent-apropos generate` writes `<slug>/SKILL.md` for every `skill: true` doc in\n# docs/conventions/. Do not edit these by hand — edit the source doc instead;\n# `agent-apropos generate --check` fails if a wrapper drifts from its source."