{
  "markdown": "# Slop Gate\n\n![Slop Gate](docs/slop-gate.png)\n\nSlop Gate is a Claude Code plugin that adds lifecycle hooks to surface\ncandidate intent drift. When a drift pattern is found, the hook injects an\nadvisory reflection request as additional context on the current event so\nClaude can see and respond to it without halting. The one exception is\n`PreToolUse`, where the hook denies the planned tool call so the gate can\nprevent drift before it runs. The reflection request states:\n\n- the original task captured from `UserPromptSubmit`\n- the assumption being made\n- why that assumption is suspect\n- the concrete reflection Claude should do before continuing\n\nThe primary detector is intentionally simple: deterministic pattern matching\nover hook inputs such as stop responses, subagent responses, tool plans and\ninputs, tool failures, task creation, and task completion. Stop and SubagentStop\nalso include a prompt-based semantic backstop for high-confidence judgment calls\nabout unsupported completion, validation, readiness, or user-as-tester claims.\nClaude Code hooks do not expose hidden chain-of-thought; Slop Gate only sees the\nevent payloads that Claude Code provides.\n\n\n## Recent Changes\n\n- 2026-05-11 — [Top-level marketplace manifest](docs/changelog/2026-05-11-top-level-marketplace-manifest.md) — enables `claude plugin marketplace add codeninja/slop-gate` from the public repo.\n\nOlder entries live under [`docs/changelog/`](docs/changelog/).\n\n\n## Detecting Intent\nSlop Gate will automatially detect your intent as you message and interact with Claude. \n\nTo view the current intent, use the slash command:\n```\n/slop-gate:intent show\n```\n\nIf Intent is not explicitly set, it is inferred. \n\n\n## Declaring Intent\n\nSlop Gate can also detect drift against an explicit, declarative intent for the\ncurrent task. Run `/slop-gate:intent set` to declare the goal and the file\nscope, then Slop Gate will flag attempts to touch paths outside that scope:\n\n```text\n/slop-gate:intent set --goal \"Add rate limiting to API\" \\\n                     --allowed-scope \"src/middleware/**\" \\\n                     --forbidden-scope \"db/**\"\n```\n\nOn `PreToolUse` for `Write`/`Edit`/`MultiEdit`, Slop Gate checks the target\n`file_path` against the declared globs:\n\n- `forbidden_touch` (deny) — file matches a `forbidden-scope` glob.\n- `scope_creep` (advise) — `allowed-scope` is set and the file matches none of\n  the allowed globs.\n\nFor `Bash`, Slop Gate extracts write targets on a best-effort basis from\noutput redirects (`> file`, `>> file`), `tee`, `rm`, `mv`, `cp`, `truncate`,\nand `sed -i`. Complex pipelines and interpreter-as-arg invocations\n(`python script.py out.txt`) are not parsed — treat Bash coverage as advisory.\n\nUse `/slop-gate:intent show` to inspect the current intent and\n`/slop-gate:intent clear` to remove it. The intent file is project-scoped,\nwritten to `<state-dir>/intent.json`.\n\n## Dismissing False Positives\n\nWhen a drift pattern produces a false positive, use `/slop-gate:dismiss` to\nsuppress matching findings without editing or removing the pattern itself:\n\n```text\n/slop-gate:dismiss premature_completion --substring \"ready for device\"\n/slop-gate:dismiss forbidden_touch --project --reason \"test fixtures\"\n```\n\nDismissals are append-only — they never rewrite the pattern repository, only\nsuppress matches that fit the dismissal record. Each record names a\n`patternId`, an optional `substring` to narrow which match texts are\nsuppressed, and a scope (`session` by default, `--project` to persist across\nsessions). Records live in `<state-dir>/dismissals.jsonl`. To undo a\ndismissal, delete its line from the file by hand.\n\n\n## Flagging Missed Drift In-Session\n\nWhen Claude drifts inside the current conversation and the hook missed it,\nuse `/slop-gate:slop` to flag the offense, propose a reusable pattern\nupdate, and get back on track without leaving the session:\n\n```text\n/slop-gate:slop you keep editing the migration files after I told you they're out of scope\n```\n\nThe command restates the original intent, names the root cause as an\nabstract drift shape, and drafts a pattern diff — either a new\n`## Pattern: <id>` section or an `### Extensions` block on an existing\npattern. Nothing is written until you confirm: answer `y` to apply, `edit`\nto revise the proposal, or `skip` to keep the correction local without\ntouching the repository. On `y`, the `pattern-curator` agent performs the\nappend-only write and `npm test` runs to confirm the repository still\nparses. The command then continues the original task with the corrected\ndirection.\n\n`/slop-gate:slop` operates only on the current conversation. To learn\npatterns from prior Claude Code session histories, use\n`/slop-gate:audit-history` and `/slop-gate:ingest-history` instead.\n\n\n## Pattern Memory Policy\n\nThe pattern repository is append-only by default. Claude may add new patterns or\nappend signals/examples to existing patterns. It may not remove, rewrite,\nrename, reorder, or overwrite patterns unless the user explicitly approves that\ndestructive maintenance in the current conversation.\n\nThe hook enforces that policy for `patterns/*.md` edits. Direct `Write`\noverwrites, destructive `Edit`/`MultiEdit` changes, and shell-based mutations of\nthe pattern repository are denied unless the user has explicitly approved\nremoval or rewriting.\n\n\n## Install\n\nAfter the GitHub repository is public, users can install Slop Gate from the\npublic marketplace hosted by this repo:\n\n```bash\nclaude plugin marketplace add codeninja/slop-gate --scope user\nclaude plugin install slop-gate@codeninja-slop-gate --scope user\n```\n\nFor local development before publishing, add the marketplace from the working\ntree:\n\n```bash\nclaude plugin marketplace add \"$(pwd)\" --scope user\nclaude plugin install slop-gate@codeninja-slop-gate --scope user\n```\n\nTo refresh an existing install after local changes:\n\n```bash\nclaude plugin update slop-gate@codeninja-slop-gate\n```\n\nThen reload plugins in any active Claude Code session:\n\n```text\n/reload-plugins\n```\n\nMarketplace-installed plugins are copied into Claude's plugin cache. Use\n`claude --plugin-dir .` when developing this plugin so Claude loads the working\ntree directly.\n\n## Public Release Checklist\n\nBefore sharing the public marketplace:\n\n```bash\nnpm test\nnpm run plugin:validate\n```\n\nThen commit the release, validate the release tag, push it to GitHub, and\ncreate/push the plugin release tag:\n\n```bash\ngit add .\ngit commit -m \"Prepare Slop Gate public plugin release\"\nclaude plugin tag --dry-run .\ngit push origin main\nclaude plugin tag . --push\n```\n\n\nTo submit Slop Gate to Anthropic's public plugin directory, use the public\nGitHub repository URL in one of the submission forms linked in the Claude plugin\nsubmission docs. The official directory is surfaced in Claude Code as the\n`claude-plugins-official` marketplace after review.\n\n## First-Time History Ingestion\n\nAfter Slop Gate is installed, use these slash commands in order:\n\n```text\n/slop-gate:setup\n/slop-gate:audit-history --yes\n/slop-gate:ingest-history drift-history-audit.md\n/slop-gate:verify\n```\n\n`/slop-gate:audit-history` scans previous Claude Code transcript JSONL files\nunder `~/.claude/projects`, writes a redacted candidate corpus to\n`drift-history-audit.md`, and summarizes likely drift families. It does not edit\nthe pattern repository. `/slop-gate:ingest-history` reviews that audit, invokes\nthe pattern curator, and appends only reusable high-confidence drift patterns to\n`patterns/drift-patterns.md`.\n\nValidate the plugin manifest and hooks:\n\n```bash\nnpm run plugin:validate\n```\n\nRun deterministic hook tests:\n\n```bash\nnpm test\n```\n\nRun the real Claude Code e2e smoke test:\n\n```bash\nnpm run test:e2e\n```\n\nThe e2e script uses `claude -p --plugin-dir .` and inspects the stream JSON hook\nevents. It prints the prompt sent to Claude, Claude's streamed text output, the\nSlop Gate correction delivered back to Claude, and a compact effect check showing\nthat the hook correction and block decision reached the stream. It is not part of\nthe default test command because it requires a working Claude Code login and may\nmake model calls.\n\nTo keep the raw Claude debug and stream files after the e2e run:\n\n```bash\nSLOP_GATE_E2E_KEEP=1 npm run test:e2e\n```\n\n## Plugin Layout\n\n- `.claude-plugin/plugin.json` declares the Claude Code plugin.\n- `marketplace.json` declares the local/public marketplace entry used for\n  permanent installation.\n- `commands/` provides `/slop-gate:*` slash commands for first-time setup,\n  history auditing, pattern ingestion, intent declaration, false-positive\n  dismissal, in-session drift flagging (`/slop-gate:slop`), and verification.\n- `hooks/hooks.json` registers the hook on relevant Claude Code lifecycle\n  events.\n- `agents/pattern-curator.md` lets Claude reflect on mistakes and append or\n  extend the pattern repository.\n- `skills/reflect/SKILL.md` gives users a namespaced way to ask Claude to learn\n  from drift, for example `/slop-gate:reflect <mistake>`.\n- `patterns/drift-patterns.md` is the append-only markdown pattern repository\n  loaded by the hook.\n- `bin/slop-gate-hook` is the executable hook entrypoint.\n- `scripts/audit-claude-history.js` scans Claude Code transcript JSONL files and\n  creates a local candidate corpus for pattern curation.\n- `src/` contains the pattern engine, intent detectors, dismissal loader,\n  state handling, and event response logic.\n- `docs/drift-abstracts.md` maps the original `drift-findings.md` examples into\n  reusable detection families.\n",
  "bytes": 9491,
  "sha": "4a59c1a501e654c0829eb265bc96f13f472e9878d3f0bb52f58cccce67deb9a3",
  "repo_slug": "codeninja/slop-gate",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_codeninja_slop_gate_slop_gate_1e183fbb/readme"
}