About masondelan/selvedge
masondelan/selvedge is an MCP server published by masondelan in the RAG category: era codebases. AI agents call it to log structured change events (entity + diff + reasoning) before the session ends, then query history with diff, blame, history, changeset, and search. Captures the intent that would otherwise evaporate. Conduid read 14 tools from its source: apply_choice, blame, changeset, diff, history, log_change and 8 more. It is published to PyPI as selvedge and runs with uvx.
The repository has 28 stars and 1 forks, and its last commit was on 30 Nov 2026. Conduid has no tagged release on record for it. It passes all 1 static checks Conduid ran on the repository. Its topics include agent-trace, ai-agent-reasoning, ai-code-provenance, ai-codebase-memory, ai-coding and codebase-change-tracking.
Install
uvx selvedgepip install selvedgegit clone https://github.com/masondelan/selvedgeTools (14)
apply_choiceWrite one allowed value to this fixture's configuration and explain why.| Parameter | Type | Description |
|---|---|---|
| rationale * | string | |
| value * | string |
blameMost recent change + context for an exact entity, plus the derived decision `status` (active / reverted / reopened)| Parameter | Type | Description |
|---|---|---|
| entity_path * | string | Exact entity path (no prefix matching). Examples: 'users.email', 'src/auth.py::login', 'env/STRIPE_SECRET_KEY'. |
changesetAll events grouped under a named feature/task slug| Parameter | Type | Description |
|---|---|---|
| changeset_id * | string | The changeset identifier (the same slug or UUID passed to `log_change`'s changeset_id parameter). Examples: 'add-stripe-billing', 'fix-auth-redirect'. |
diffHistory for an entity or entity prefix, each row annotated with `superseded_by`| Parameter | Type | Description |
|---|---|---|
| entity_path * | string | Entity path, or a DOTTED prefix of one: 'users' also covers 'users.email'. Not a raw string prefix — 'src/' matches nothing, and 'src/auth.py' does not cover 'src/auth.py::login'. |
| limit | integer | Maximum number of events to return. |
historyFiltered history across all entities| Parameter | Type | Description |
|---|---|---|
| changeset_id | string | Filter to a specific changeset (feature/task group). |
| entity_path | string | Filter to an entity, or a DOTTED prefix of one ('users' also covers 'users.email'). Not a raw string prefix. |
| limit | integer | Maximum number of results. |
| project | string | Filter to a specific project/repository. |
| since | string | Time window — ISO 8601 datetime OR relative shorthand: '15m' (last 15 minutes), '24h' (last 24 hours), '7d' (last 7 days), '5mo' (last 5 months), '1y' (last year). 'm' means minutes; 'mo' or 'mon' means months. Unparseable values produce an error rather than silently returning empty results. Empty = all time. |
log_changeRecord a change event with entity, diff, and reasoning. `rename_from` + `change_type="rename"` records the dual-event rename pattern; `change_type="supersede"` re-opens a reverted decision (append-only); optional `constraint` / `stale_when` keep the decision's principle and its invalidation condition queryable| Parameter | Type | Description |
|---|---|---|
| agent | string | Name/ID of the AI agent making the change (e.g. 'claude-code', 'cursor', 'copilot', 'human'). |
| change_type * | string | What kind of change. One of: add, remove, modify, rename, retype, create, delete, index_add, index_remove, migrate, revert (tried and rolled back), reject (considered and decided against, without writing the change), supersede (re-open a reverted decision). Invalid values are rejected — pick the closest match. |
| changeset_id | string | Optional grouping ID for related changes that belong to the same feature or task. Use a short slug like 'add-stripe-billing'. All events sharing a changeset_id can be queried together via the `changeset` tool. |
| constraint | string | Optional: the testable principle behind the decision, kept queryable (e.g. 'card data in our own DB = PCI scope'). |
| diff | string | The actual change — SQL migration text, code diff, or a human-readable description of what changed. Optional but strongly recommended for non-trivial changes. |
| entity_path * | string | Dot/slash-notation path to the entity. Required and non-empty. Examples: 'users.email' (DB column), 'users' (DB table), 'src/auth.py::login' (function in file), 'src/auth.py' (file), 'api/v1/users' (API route), 'deps/stripe' (dependency), 'env/STRIPE_SECRET_KEY' (env variable). |
| entity_type | string | Category of entity. One of: column, table, file, function, class, endpoint, dependency, env_var, index, schema, config, other. Unknown values are coerced to 'other'. |
| expires_when | string | Optional machine-checkable expiry condition for this decision. Closed grammar, validated at write time: 'library:NAME>=VERSION' (revisit when the named dependency reaches a version, e.g. 'library:django>=5.0'), 'entity:PATH:changes' (revisit when that entity next changes, e.g. 'entity:users.email:changes'), 'date:ISO' (revisit on a date, e.g. 'date:2027-01-01'), or 'manual:LABEL' (opaque label for human review; never auto-fires). `stale_decisions` evaluates these from local state — no network, no LLM — and flags 'expired' with the pattern that fired. Values outside the grammar are rejected. |
| git_commit | string | The git commit hash this change will land in. Can be backfilled later via `selvedge backfill-commit` or the post-commit hook. |
| project | string | Repository or project name. Useful when one DB tracks multiple projects. |
| reasoning | string | Why the change was made. Include the user's original request, the problem being solved, or any context that won't be obvious from the diff alone. Good example: 'User asked to add 2FA — needs phone number to send SMS verification codes.' Avoid generic placeholders like 'user request' or 'done' — these are flagged by the quality validator and returned in `warnings`. |
| rename_from | string | The entity's previous path, when this change is a rename. Set it together with change_type='rename' and put the NEW path in entity_path. Selvedge records the dual-event rename pattern: a 'rename' event on the old path and a 'create' event on the new path whose metadata.renamed_from points back to the old one, so blame/diff/prior_attempts on the new path still see the history. Leave empty for any non-rename change. |
| revisit_after | string | Optional revisit date for an architectural decision (table, schema, dependency, config). An ISO date OR a relative offset from this event's timestamp (e.g. '90d', '6mo'). `stale_decisions` surfaces it once it passes, if the entity is still in active use. Leave empty otherwise. |
| session_id | string | The agent session or conversation ID, if available. |
| stale_when | string | Optional: what would invalidate this decision (e.g. 'payment provider changed'). stale_decisions matches it against later events and flags 'review suggested' — surfacing only. |
| supersedes | string | Id of the prior event this change overrides; only valid with change_type='supersede'. Empty auto-links the entity's most recent removal event (remove/delete/index_remove/revert/reject) — so after a standalone rejection it re-opens the rejection. Append-only — the old verdict is never edited, just derived as superseded. |
prior_attemptsPrior change attempts on an entity + inferred outcome (tried → reverted → re-opened) — call it before editing. Optional `fuzzy` query adds semantically similar records (needs the `semantic` extra; falls back to substring)| Parameter | Type | Description |
|---|---|---|
| description | string | Free-text description of what you're about to do, when you don't have an exact entity_path. Matched as a substring against prior reasoning, diffs, and entity paths. Provide this OR `entity_path` (entity_path takes precedence if both are given). |
| entity_path | string | The entity you're about to change. Exact path with prefix matching — 'users' also covers 'users.email'. Examples: 'src/auth.py::login', 'users.email', 'env/STRIPE_SECRET_KEY'. Provide this OR `description`. |
| fuzzy | string | Optional semantic query: also return attempts on entities whose prior reasoning is similar to this text — catches renames (payment_token vs card_token). Rows are labeled match_type='fuzzy' with a similarity score; without the selvedge[semantic] extra it falls back to substring matching and says so in a leading note row. |
| limit | integer | Maximum number of results. |
| min_confidence | string | Confidence floor. 'proximity_high' (default) returns the high-signal rows: attempts closed by an explicit revert/reject (confidence 'exact' — always clears this floor, including standalone rejections) plus attempts reverted within the window. Pass 'proximity_low' to also see the noisy tail (still-active changes and far-apart reverts). |
| window_minutes | integer | Proximity window in minutes for the add->remove revert heuristic — the tiebreaker for IMPLICIT removal types only. An attempt removed within this many minutes is 'proximity_high'; beyond it, 'proximity_low'. Attempts closed by an explicit revert/reject are 'exact' regardless of the window. Default 10080 (7 days). |
read_decisionsRead the project's maintained decision file, if one exists.read_fileRead an exact project filename; no filesystem traversal or host access.| Parameter | Type | Description |
|---|---|---|
| path * | string |
read_projectRead the current task, permitted Python subset and available project files.run_checksExecute the public checks against the written solution, at most twice.searchFull-text search across all events| Parameter | Type | Description |
|---|---|---|
| limit | integer | Maximum number of results. |
| query * | string | Search string (case-insensitive substring). Searches across entity_path, diff, reasoning, and agent fields. SQL LIKE wildcards (`_` and `%`) are escaped, so 'stripe_customer_id' matches the literal underscore rather than any single char. |
stale_decisionsDecisions due for a revisit: past their `revisit_after` and still in active use (`flag="revisit_due"`), or whose `stale_when` condition matched a later change (`flag="review_suggested"`)| Parameter | Type | Description |
|---|---|---|
| agent | string | Optional filter to the agent that logged the decision. |
| entity_path | string | Optional filter to a single entity or path prefix — 'users' also covers 'users.email'. Empty = every entity. |
| limit | integer | Maximum number of results. |
| project | string | Optional filter to a specific project/repository. |
write_fileWrite solution.py only (at most two writes, at most 16,000 characters).| Parameter | Type | Description |
|---|---|---|
| content * | string | |
| path * | string |
Security checks
- ✓README presentThe repository's README runs to about 2.8K words.
5 checks have not been run yet.
README
The repository's README runs to about 2.8K words. The original in the repository is authoritative.
Read full README