feat: rework Priors as a Claude Code plugin (memory always on, writing gated by mode)#14
Merged
Merged
Conversation
…g gated by mode) Priors used to be CLI-first: users typed `priors stage --source-content @… --candidates @…` and managed a `staged/` queue by id. This rework moves the human surface into Claude Code (and Cursor where practical) while keeping the safety substrate — MCP server, deterministic brief, append-only audit, quote-or-refuse, idempotency, project-as-subject — untouched. What's new - Plugin scaffold at repo root using the modern Claude Code layout per https://code.claude.com/docs/en/plugins: .claude-plugin/plugin.json .claude-plugin/marketplace.json # single-plugin marketplace catalog skills/<name>/SKILL.md # one folder per slash command agents/priors-steward.md hooks/hooks.json + hooks/scripts/ .mcp.json - Slash commands are auto-namespaced as /priors:<name>: /priors:status, /priors:brief, /priors:recall, /priors:why, /priors:impact, /priors:reflect, /priors:log, /priors:rules, /priors:rule-add, /priors:export. - Single-plugin marketplace install: /plugin marketplace add https://github.com/claudialnathan/priors /plugin install priors@priors - Cursor compatibility: .cursor/rules/priors.mdc (always-apply rule) + .cursor/mcp.json. Legacy single-file .cursorrules removed in favour of the modern .cursor/rules/*.mdc directory format. - Two modes (auto | manual) in .priors/config.json. Memory use is always on; memory writing toggles between modes. CLI: `priors mode [auto|manual]`. - New entry kind `rule`. User-authored rules write directly via `priors rule add` (or /priors:rule-add); agent-inferred rules still flow through the quote-or-refuse review queue. - Readable IDs (D-001, F-004, R-002) for human-facing flows; canonical slug ids preserved in metadata, exports, and --json output. - New surfaces: /priors:why, /priors:impact, /priors:reflect, /priors:log, /priors:rules, /priors:rule-add, /priors:status. Pushback formatter, natural-language log-intent detector, and significance gate as pure modules under src/intent/ and src/session/. - Lifecycle hooks (SessionStart, UserPromptSubmit, PreCompact, Stop) all bounded; none call an LLM. What's preserved - MCP server, tool surface, and resource paths. - Deterministic priors://brief (no LLM in the assembler). - Quote-or-refuse on agent-proposed candidates (substring + Dice-coefficient grounding floor). - Append-only audit logs. - Idempotency keys on every MCP write tool. - The .priors/ store layout. New entries/rules/ directory is additive. - Seven-task regression suite. - All existing CLI subcommands. Cleanup and conventions - Removed previously-tracked personal Claude Code dev-tool installs (.agents/, .claude/skills/, .cursorrules legacy single-file format) from the public tree. Convention: anything at .claude/agents/, .claude/skills/, CLAUDE.local.md is gitignored personal dev tooling; the plugin's own published assets live at agents/, skills/, hooks/, .claude-plugin/, .mcp.json (no leading dot for the plural-noun directories). - CLAUDE.local.md template added (gitignored) so maintainers can keep personal notes without leaking to plugin users. Tests: 186 → 232 (+46), all green. Docs: README, AGENTS.md, CLAUDE.md fully rewritten. New docs/plugin-architecture.md and docs/maintainer-guide.md. New repo-level CHANGELOG.md (excluded from npm package). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Records that `git filter-repo` was used on this date to scrub personal Claude Code dev-tool installs (`.agents/`, `.claude/skills/`, `skills-lock.json`) and the legacy `.cursorrules` file from all of main's history. Pre-rewrite commit SHAs are no longer reachable. Anyone with an older clone needs to re-clone or hard-reset. The published npm tarballs (priors@1.0.0-rc.0, priors@1.0.0-rc.1) were verified clean before the rewrite — `package.json` `files[]` had already excluded those paths from the published packages, so nothing on npm needed retraction. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reworks Priors from CLI-first into a Claude Code plugin-first product, while keeping the safety substrate (MCP server, deterministic brief, quote-or-refuse, append-only audit, idempotency, project-as-subject) intact.
Replaces the auto-closed PR #13 (closed by GitHub when the branch was force-pushed after a
git filter-repohistory cleanup — see "History rewrite" section below).Users used to type
priors stage --source-content @… --candidates @…and manage astaged/queue by id. With this PR, day-to-day flow moves into Claude Code:Then
/priors:recall,/priors:log,/priors:rules,/priors:why,/priors:impact,/priors:reflect, etc.What's new
.claude-plugin/plugin.json+.claude-plugin/marketplace.json(single-plugin marketplace catalog)skills/<name>/SKILL.md(10 slash commands, auto-namespaced as/priors:<name>)agents/priors-steward.mdhooks/hooks.json+ bounded shell scripts.mcp.jsonauto|manual) in.priors/config.json. Memory use is always on; memory writing toggles between modes. Auto mode is bounded by a significance gate.rule. User-authored rules write directly viapriors rule add(or/priors:rule-add— the user typed the claim, no quote-or-refuse needed). Agent-inferred rules still pass through the review queue.D-001,F-004,R-002) for human-facing flows. Canonical slug ids preserved in metadata, exports, and--jsonoutput./priors:why,/priors:impact,/priors:reflect,/priors:log,/priors:rules,/priors:rule-add,/priors:status. Pushback formatter, natural-language log-intent detector, and significance gate live as pure modules undersrc/intent/andsrc/session/..cursor/rules/priors.mdc(always-apply rule) +.cursor/mcp.json. Legacy single-file.cursorrulesremoved in favour of the modern.cursor/rules/*.mdcdirectory format.SessionStart,UserPromptSubmit,PreCompact,Stop) — all bounded, none call an LLM.What's preserved
priors://brief(no LLM in the assembler — same store in, same bytes out)..priors/store layout. The newentries/rules/directory is additive.Backward compatibility: existing entries parse unchanged (all new frontmatter fields are optional). Existing CLI users keep their full surface.
History rewrite
git filter-repowas used on this branch to scrub personal Claude Code dev-tool installs (.agents/,.claude/skills/,skills-lock.json) and the legacy.cursorrulesfrom all of main's history. Pre-rewrite commit SHAs are no longer reachable. Anyone with an older clone needs to re-clone orgit fetch && git reset --hard origin/main.The published
priors@1.0.0-rc.0andpriors@1.0.0-rc.1npm tarballs were verified clean before the rewrite (thepackage.jsonfiles[]allowlist had already excluded those paths from the published packages), so nothing on npm needed retraction.Personal vs shipped — gitignore convention
CLAUDE.local.mdCLAUDE.md.claude/agents/<name>.mdagents/priors-steward.md.claude/skills/<name>/SKILL.mdskills/<name>/SKILL.md.claude/settings.local.json.claude-plugin/plugin.json.cursor/rules.local/<name>.mdc.cursor/rules/priors.mdcRule of thumb: leading dot (
.claude/...) = personal; plural noun without leading dot (agents/,skills/) = the plugin's published asset.Test plan
npm test— 232/232 passing (was 186 before this PR)/tmp:init,mode auto/manual,rule add,log,rules,status,resolve,recall,hook session-start/user-prompt,impact,reflect,why— all workinggit filter-repohistory rewrite produces a clean history acrossmain,feat/plugin-rework, andlegacy/v0.3.01.0.0-rc.0,1.0.0-rc.1) are clean — no personal artifacts ever shipped/plugin marketplace add— verify hooks fire and slash commands appear in a fresh Claude Code session.priors/lands in the user project (not the plugin dir) when installedAfter merge
package.jsonversion to1.1.0-rc.1(additive, still rc).v1.1.0-rc.1.npm publish --tag next.🤖 Generated with Claude Code