Skip to content

feat: rework Priors as a Claude Code plugin (memory always on, writing gated by mode)#14

Merged
claudialnathan merged 2 commits into
mainfrom
feat/plugin-rework
Apr 28, 2026
Merged

feat: rework Priors as a Claude Code plugin (memory always on, writing gated by mode)#14
claudialnathan merged 2 commits into
mainfrom
feat/plugin-rework

Conversation

@claudialnathan

Copy link
Copy Markdown
Owner

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-repo history cleanup — see "History rewrite" section below).

Users used to type priors stage --source-content @… --candidates @… and manage a staged/ queue by id. With this PR, day-to-day flow moves into Claude Code:

/plugin marketplace add https://github.com/claudialnathan/priors
/plugin install priors@priors

Then /priors:recall, /priors:log, /priors:rules, /priors:why, /priors:impact, /priors:reflect, etc.

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 (10 slash commands, auto-namespaced as /priors:<name>)
    • agents/priors-steward.md
    • hooks/hooks.json + bounded shell scripts
    • .mcp.json
  • Two modes (auto | manual) in .priors/config.json. Memory use is always on; memory writing toggles between modes. Auto mode is bounded by a significance gate.
  • New entry kind rule. User-authored rules write directly via priors 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.
  • 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 live as pure modules under src/intent/ and src/session/.
  • 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.
  • Lifecycle hooks (SessionStart, UserPromptSubmit, PreCompact, Stop) — all bounded, none call an LLM.

What's preserved

  • MCP server and full tool surface.
  • Deterministic priors://brief (no LLM in the assembler — same store in, same bytes out).
  • 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. The new entries/rules/ directory is additive.
  • Seven-task regression suite. Every existing CLI subcommand.

Backward compatibility: existing entries parse unchanged (all new frontmatter fields are optional). Existing CLI users keep their full surface.

History rewrite

git filter-repo was used on this branch to scrub personal Claude Code dev-tool installs (.agents/, .claude/skills/, skills-lock.json) and the legacy .cursorrules from all of main's history. Pre-rewrite commit SHAs are no longer reachable. Anyone with an older clone needs to re-clone or git fetch && git reset --hard origin/main.

The published priors@1.0.0-rc.0 and priors@1.0.0-rc.1 npm tarballs were verified clean before the rewrite (the package.json files[] allowlist had already excluded those paths from the published packages), so nothing on npm needed retraction.

Personal vs shipped — gitignore convention

Concern Personal (gitignored) Shipped (tracked)
Project memory CLAUDE.local.md CLAUDE.md
Subagents .claude/agents/<name>.md agents/priors-steward.md
Skills .claude/skills/<name>/SKILL.md skills/<name>/SKILL.md
Settings .claude/settings.local.json .claude-plugin/plugin.json
Cursor rules .cursor/rules.local/<name>.mdc .cursor/rules/priors.mdc

Rule 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)
  • CLI smoke test in /tmp: init, mode auto/manual, rule add, log, rules, status, resolve, recall, hook session-start/user-prompt, impact, reflect, why — all working
  • Verified git filter-repo history rewrite produces a clean history across main, feat/plugin-rework, and legacy/v0.3.0
  • Verified published npm tarballs (1.0.0-rc.0, 1.0.0-rc.1) are clean — no personal artifacts ever shipped
  • Plugin install via /plugin marketplace add — verify hooks fire and slash commands appear in a fresh Claude Code session
  • Verify .priors/ lands in the user project (not the plugin dir) when installed

After merge

  1. Bump package.json version to 1.1.0-rc.1 (additive, still rc).
  2. Tag v1.1.0-rc.1.
  3. npm publish --tag next.

🤖 Generated with Claude Code

claudialnathan and others added 2 commits April 28, 2026 10:29
…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>
@claudialnathan claudialnathan merged commit 42d38c4 into main Apr 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant