Skip to main content
Glama

stepwell

CLI + MCP server for reading, checking and managing the project docs (BACKLOG.md, PROGRESS.md, docs/archive/*) in repos following the STEPWELL method — steps, archive pattern, test-first.

New here? Start from docs/QUICKSTART.md — the five-minute entry (core loop, the four files, the five rules).

Status: 24 phases complete. Phase 1 — core library (fault-tolerant parsers, status/validation reports) · Phase 2 — MCP server + CLI (read tools, resources) · Phase 3 — mutations (archive_item, progress_update, each dry-run + apply) · Phase 4 — locale profiles (de/en, test-first) · Phase 5 — server name stepwell · Phase 6 — review fixes (stale span, synonym regexes, CRLF roundtrip, stale check, STEP_DUPLICATE) + tool CRUD (backlog_add/update/remove, progress_plan_phase, CLI ASCII aliases, title parameter). Phases 7–15: CI + field test + packaging, archive/index hardening, coverage gate, annotations, init/templates, JSON schema versioning, token economy, STEPWELL naming, language switch to English primary. Phases 16–19: English docs + review follow-ups (multi-step completion, archive ordering, inline accepted markers). Phases 20–24: line-split alignment for mixed line endings (K1), Quick-Start guide, ISO 8601 timestamps, method retrospective + decision consolidation, PLAYBOOK §2 tolerance fix. Current state and step history: PROGRESS.md.

Install (npm)

The packages are published on npm — the CLI works against any STEPWELL project by --root, no checkout of this repo needed:

npm install -g stepwell            # CLI + MCP server (stepwell-core/-git included)
npx stepwell status --root .       # aggregate of the current repo's four docs files
npx stepwell validate --root .     # cross-consistency check (exit 1 on findings)

npm package

purpose

stepwell

CLI + MCP server (thin transport)

stepwell-core

parser + reports + validation (library)

stepwell-git

git satellite (workstream sync, commit automation)

MCP registration (stdio): node <npm-root>/stepwell/dist/serve.js — resolve <npm-root> via npm root -g; details in packages/mcp/README.md.


Related MCP server: markdown-mcp

Principles

  1. Markdown stays the source of truth. The tool reads, validates and assists — it does not replace the docs. If the docs are lost, no data is lost.

  2. Fault tolerance instead of abort. Projects follow the method, not byte-exact: structure drift is reported as a structured warning (ParseResult<T> with warnings[]), never as a crash. Every partial result stays queryable.

  3. Dry-run first. The two write tools (archive_item, progress_update) return a plan with a diff preview by default; writing happens only with dryRun: false / --apply — afterwards the result is freshly parsed and verified.

  4. Narrow write surface. The error-prone structural operations are automated by the tool (verbatim move, Done Index, status cells, item CRUD, phase planning). Everything else (prose, goal/acceptance texts) is edited directly in the Markdown files by humans/agents.

  5. Multi-project. The project root is passed per tool call / CLI invocation — one server instance serves any number of STEPWELL projects.

File requirement: all four files are mandatory — BACKLOG.md, PROGRESS.md, docs/archive/BACKLOG_ARCHIVE.md, docs/archive/PROGRESS_ARCHIVE.md. If one is missing, the project does not load (hard error with a clear message).

Archive sharding (H11/H12/32.x): large projects split the archives into shards per phase — docs/archive/*_ARCHIVE.p<n>.md, named by phase number. Rotation is fully tool-op: item blocks append to the running phase's shard, the phase block lands on its own shard at completion; each shard carries a write-once header. The canonical files freeze as legacy homes (pre-sharding stock + appends without a running phase); the Done Index is coupled — an index line lives where its block lives (INDEX_LOCATION finding otherwise). All readers (validate, status, show, hashes, commit staging, sync) see the concatenated view (PLAYBOOK §3 "Archive sharding").

Format legend (canonical: PLAYBOOK §3 + §7):

Symbol

Meaning

ID series

🔴 critical · 🟠 high · 🟡 medium · 🟢 low

backlog priority = section

K/H/M/L (auto numbering)

🔵 test gap

backlog priority = section

no series — explicit ID required

⬜ open · 🔄 in progress · ✅ done · ⛔ blocked

step status in PROGRESS.md

steps <Phase>.<x> (e.g. 7.2)

other series letters (R, T, D, …)

thematic series, not priority-bound

consecutive, never reused

Archive ordering (M10/Decision 19): completed phase blocks are appended chronologically at the end of PROGRESS_ARCHIVE.md — the archives stay strictly append-only, so phase numbers there may be non-monotonic (a post-hoc completed older phase lands after younger ones, e.g. … 53 → 55 → 54). Deliberately no insert at the phase-number position (that would be a write into existing history). The progress table in PROGRESS.md stays the complete, permanent index.


Requirements & setup

  • Node.js ≥ 22.18 — the repo ships TypeScript source and uses Node's native type stripping (no build step).

npm install
npm run typecheck   # strict, covers src AND tests
npm run test        # Vitest, protocol-faithful against the fixtures
npm run test:watch

MCP server

Server name stepwell (transport stdio, entry packages/mcp/src/serve.ts).

Foreign repos are safe (M13): the server stays passive — in a repo without the four STEPWELL files, read operations return a neutral "No STEPWELL project here — no action required" hint and nothing is ever created, written or initialized without the user explicitly asking to adopt STEPWELL.

This repo already wires the server into opencode.json (restart opencode after config changes). Other MCP clients (Claude Desktop, Cursor, …) follow the same pattern:

{
  "mcp": {
    "stepwell": {
      "type": "local",
      "command": ["node", "/path/to/stepwell-tool/packages/mcp/src/serve.ts"],
      "enabled": true
    }
  }
}

Manual verification with the inspector:

npx @modelcontextprotocol/inspector node packages/mcp/src/serve.ts

The test suite covers the same protocol path automatically (InMemoryTransport + client, plus a real stdio handshake test).

Distribution (two channels)

  1. MCP server: npx stepwell (or serve.ts) — operational, tools as below. The published package ships compiled dist (since 10.4/H1) and therefore runs directly from node_modules — prepublishOnly builds before publishing.

  2. SKILL.md: packages/mcp/skills/stepwell/SKILL.md (included in the npm pack) — portable signpost for skill ecosystems (Claude Skills, Gemini CLI, …): which tool when, gates (release/content), test-first, status maintenance only via tools. It replaces neither the MCP server nor PLAYBOOK.md — both remain binding.

Tools

All tools take root (absolute path to the project root) per call. All JSON text payloads are compact (no indentation — token economy, E1). docs_validate, progress_update and archive_item also deliver their data as structuredContent only on opt-in with structured: true (M3/9.7, dedupe since E1 — default is text only); error responses (isError: true, including PROJECT_NOT_INITIALIZED) carry no structuredContent. Errors (missing mandatory file, unknown ID/phase) return isError: true with a clear message — the server does not crash.

Read

Tool

Parameters

Result

docs_status

root, optional include[]

Aggregate: open items per priority, 🔄 steps + assigned phases, ✅ quote of the table, all findings + warnings, hashes (SHA256 per doc file, E2) and docFiles (lines/bytes per doc file — canonical four + shards, L24/32.7); with include: ["nextStepScope"] (E2) additionally goal/acceptance/scope bullet + merged backlog item of the next step (1 call instead of progress_show + backlog_show); with include: ["templates"] (M32/45.3) an uninitialized root additionally returns the four file skeletons inline (templates — bootstrap hint, because stepwell://templates/* resources are not readable from every agent surface; initialized roots never carry the key)

backlog_list

root, optional priority[], open, section, ready (M21/30.6), fields[] (now incl. files — H10/30.4, dependsOn/blockedBy/ready — M21/30.6)

Items of BACKLOG.md without raw (lean payload) + parse warnings; every item carries files[] (path-like tokens extracted tolerantly from the Location bullet — backticks, file.ts:12 refs, lists; no invention, no glob expansion) and the dependency data (dependsOn[] from the optional Depends on: bullet, DE variant read silently; blockedBy[] = transitive OPEN ancestors; ready = open ∧ no open ancestors — unknown refs ignored for readiness), with fields (e.g. ["id","title","priority","open","section"]) items are projected onto the listed fields (token economy, E1)

backlog_show

root, id

Merge view for one item ID across open BACKLOG ↔ Done Index (BACKLOG and shard index sections, M24/32.3) ↔ archive files (canonical + shards, concatenated view H11/32.1), including raw + span; case-sensitive

progress_list

root, optional status

Rows of the progress table {step, name, status}

progress_show

root, phase

Detail block including raw — search across running phases and archive (name, title or name — title)

docs_validate

root, optional structured

Validate findings (consistency rules) + collected parse warnings, ok; findings acknowledged in place (L13) are reported separately in acknowledged[] and do not flip ok

docs_repair

root, optional structured, dryRun (default true)

Mechanical repair path for validate findings (H9/30.2) — over the responsible planners, never text manipulation: EMPTY_MARKER_STALE (placeholder removal), DATE_LEGACY YYMMDD/HHMM → ISO (MM/YYYY stays a finding — the day is not reconstructible), NOT_ARCHIVED (delegates to archive_item), ARCHIVE_WITHOUT_INDEX (Done-Index line reconstructed in the file of its block — paired index, M24/32.3), WIP_WITHOUT_PLAN (skeleton, only when the phase has no other table rows — sibling scope cannot be invented). Everything else stays a finding (human judgment). Applies sequentially with re-validation between repairs; refusals are reported, never retried. Response: {fix: {planned[], applied[], skipped[]}, changes, verification}. Deliberately a separate tool from docs_validate (M4/compatibility): a tool cannot be read-only AND mutating — docs_validate's static readOnly annotation protects consumer auto-approval flows. CLI equivalent: stepwell repair

Write (dry-run + apply)

Tool

Parameters

Behaviour

archive_item

root, id, optional note, locale, structured, detail, dryRun (default true)

Plans the verbatim move of an item: remove the block (span-based) from BACKLOG.md, in the archive copy flip the checkbox → [x], optional note becomes the done line; plus a one-liner - <ID> — <title> — done (note?) in the paired index — the line lives where the block lives (M24/32.3): while a phase n runs, the block lands on BACKLOG_ARCHIVE.p<n>.md with its own index section (sharding H12/32.2); without a running phase, on the canonical archive with the line in BACKLOG's Done Index. Apply verifies freshly: ID gone from open, present in archive + index, no findings left. This is the antidote to the NOT_ARCHIVED (D2) validate finding.

(all write tools)

—

Response contract (L33/44.2, field finding F3): every mutating tool response carries applied (true after a real write, false on plan-only runs); plan-only responses additionally carry the loud planOnly message ("PLAN ONLY — nothing was written (dryRun: true); re-run with dryRun: false to apply") so a plan echo can never be misread as an applied write. Additive fields (Decision 10: minor).

progress_update

root, phase, step (string or string[] for multi-step in one call, only with dryRun: false; all steps are validated before the first write and detail: "summary" is rejected for multi-step), status (⬜🔄✅⛔), optional title, note, checkpoint (commit SHA, 7–40 hex), locale, structured, detail, dryRun (default true)

Sets the status cell(s) of the steps (missing rows are added, name derived from the scope bullet); on 🔄 creates a detail-block skeleton under "Active Phases" (### Phase … + **Scope (Steps):** + step bullet — no invented goal/acceptance texts); title renames the block heading consistently (rename → archival in the same call is defined); if afterwards no step of the phase is still 🔄/⬜, the block moves verbatim into the phase's own shard PROGRESS_ARCHIVE.p<n>.md (sharding H12/32.2 — the canonical file keeps only the legacy stock; note/checkpoint → verification line, response contains the doc-sync reminder) — with step arrays completion is detected automatically at the last step. A step whose phase was already archived earlier in the same batch is accepted idempotently (row update only, no second append, no error — H2). Apply verifies row, block move and docs_validate.

backlog_add

root, section, title, priority (🔴🟠🟡🟢🔵), optional id, text, detail, dryRun, considerWorktrees (default false, M20/30.5)

Creates an open item at the end of the target section: ID with convention check (^[A-Z][0-9]+$), auto-assignment = next free number of the priority series (K/H/M/L; 🔵 requires an explicit ID), text bullets verbatim, As of: timestamp in the heading is updated. A title that repeats the assigned id ("H5 — …") is stripped and reported as TITLE_ID_PREFIX warning (plan + apply result, L29 — field finding F2; a foreign prefix is content and stays). Pass titles without the id prefix; notes for archive_item carry the commit reference, not the done word. With considerWorktrees: true the next free id also skips the ids occupied in ALL foreign worktree doc states (git satellite read; core stays git-blind — the transport collects, Decision 14); without git it falls back to the own tree with an additive worktreeWarnings[] entry. Explicit ids are never filtered.

backlog_update

root, id, optional title, priority, section, position (L17/30.7: "top"/"bottom"/1-based slot), text, detail, dryRun

Changes title/priority/text/section in the block format (span recomputation, checkbox and *(…)* suffix are preserved). A priority change moves the block into the matching priority section; position places the block within its (target) section — byte-identical content, with section the order is first switch then place, out-of-range slots are a structured error (never clamped).

backlog_remove

root, id, optional note, locale, detail, dryRun

No hard delete: block moves verbatim into the archive (shard BACKLOG_ARCHIVE.p<n>.md while a phase runs, canonical otherwise — H12/32.2; checkbox stays [ ], optional note → **Removed:** line), the paired index gets a tail without a done marker (- <ID> — <title> — removed (note?) — shard section while a phase runs, M24/32.3). docs_validate deliberately does not report checkbox-[ ] blocks as ARCHIVE_WITHOUT_INDEX.

progress_plan_phase

root, phase ("Phase <N>[ — Title]"), steps: [{step, name}], optional detail, dryRun, considerWorktrees (default false, M20/30.5)

Plans a phase ahead: table rows for all steps (⬜, with names) + detail-block skeleton with the full scope. Validates the step prefix (Phase 7 → 7.x), duplicates and occupied phases/steps — with considerWorktrees: true also against ALL foreign worktree doc states (structured refusal, same as own collisions). PHASE_PLANNED (warning, ok stays true) is the defined state until the first 🔄 (M18/27.9).

workstream_sync

root, direction (pull/push/status), structured, dryRun (default true)

Git workstream sync (H5/26.5): pull merges trunk → branch (risky side — conflicts abort cleanly with a structured report), push fast-forwards trunk → branch head (ancestor precondition, atomic --ff-only), status returns the read-only workstream report (per-worktree liveness + conflict-candidate overlap[] — files touched on both sides since the merge base — plus predictedOverlap[] (H10/30.4): files that OPEN items on BOTH sides name in their Location bullets, visible before anyone edits them; read-only derivation in the satellite, core stays git-blind). Dry-run runs the exact guard chain of the real op and previews the effect. Errors keep stable codes (STALE_BRANCH, DIRTY_TREE, TRUNK_DIRTY, …). CLI equivalent: stepwell sync <status|pull|push>.

Response formats: dry-run returns the plan {dryRun, changes:[{file, description, before, after, diff}]}; apply returns {written, verification:{ok, messages}}. With detail: "summary" (E1) dry-run changes are projected onto {file, description, beforeLines, afterLines} + top-level marker detail: "summary" — the default stays "diff" with the full preview (safety note unchanged). With commit: true (H5/26.3, applies only) the response carries an additional commit section — {ok, committed, files[], sha?} on success or {ok:false, error:{code, message}} (COMMIT_BLOCKED, COMMIT_FAILED); a failed commit never rolls the edits back. Multi-step batches commit once after the whole batch, and never when the apply verification failed.

Locale profiles

The doc files may be formatted in German or English — mixed within the same repo is forbidden; one language per project. The tool separates:

  • Reading: always language-tolerant (zero-config). Parser and validator recognise the role markers of both languages via union matching — Erledigt-Index|Done Index, Ort|Location, erledigt|done, Ziel|Goal, Abnahme|Acceptance, Verifikation|Verification, Umfang|Scope, Fortschritt|Progress, Laufende Phasen|Active Phases, abgeschlossen|completed, Stand:|As of:.

  • Writing: the locale option on archive_item and progress_update/ backlog_remove ("de" | "en"; default = auto-detection from the file context, tie → en since 14.3). Generated texts (index line, done/verification/removed markers, skeletons) follow the target language; CLI equivalent: --locale de|en.

  • More languages: packages/core/src/profile.ts holds the role synonyms — a new language is a new key per role, no parser rebuild.

Resources (resource templates)

The root is percent-encoded into the URI segment (Windows paths contain : and \); the read callback decodes it. Content verbatim, text/markdown:

stepwell://{root}/backlog          → BACKLOG.md
stepwell://{root}/progress         → PROGRESS.md
stepwell://{root}/archive/{kind}   → kind = "backlog" | "progress" (canonical file;
                                     shard content is served via the read tools, which
                                     concatenate shards — no extra URI kinds, M25/32.4)
stepwell://{root}/phase/{phase}    → phase context: phase verbatim + table rows
                                     + merged backlog item bodies in step order (G5/12.6)
stepwell://{root}/hashes           → SHA256 per doc file (application/json;
                                     hash short-circuit, E2/12.5 — fast-path
                                     foundation E3; keys = canonical four + existing
                                     archive shards, M25/32.4)
stepwell://templates/{kind}        → skeletons of the four mandatory files
                                     (kind = "backlog" | "progress" |
                                      "backlog-archive" | "progress-archive")

M4 alternative check (G5): resource instead of tool — the phase context is a pure read path, and the composition happens at read time instead of as a duplicate in the files (anti-drift): a subagent gets phase + item bodies in one read, without a new tool growing the surface.

Example: stepwell://D%3A%5Cproj%5Cdemo/backlog

Project init (M8, variant A): for newly created projects the agent reads the four skeletons from stepwell://templates/{kind} and creates the files itself — deliberately no init_project write tool (M4 guardrail: keep the write surface small); the skeletons live canonically in stepwell-core (projectTemplates) and are finding-free under docs_validate. The init-fallback guidance (PROJECT_NOT_INITIALIZED) points to this path.


CLI

packages/mcp/src/cli.ts — runnable directly in the workspace repo (node packages/mcp/src/cli.ts …); from the installed package (npm i -g stepwell or npx stepwell) under the bin name stepwell. Human output on stdout; --json returns the core payloads with a leading schema version field (currently 2, bumped with N1/13.2 — a resource-URI change is a MAJOR contract). Field contract per command:

Command

Fields (besides schema)

status

openByPriority, openTotal, runningSteps, runningPhases, doneQuote, nextStep, nextPriority, warnings

backlog

count, items[] (without raw), warnings

progress

count, rows[], warnings

validate

findings[] (blocking), acknowledged[] (accepted in place, L13), warnings[], ok

archive (dry-run)

root, id, dryRun, note, changes[]

archive --apply

written[], verification{ok, messages[]}, commit? (with --commit, H5/26.3)

progress-update

like archive plus phase, step, status, title, completedPhase, checkpoint?, commit? (with --commit)

sync <direction>

direction, dryRun + preview payload (behind, files[], overlap[] for pull; ahead, target for push) or op payload (fastForward, mergedFiles, validation), error{code, message} on failure (H5/26.5)

Contract rule (M6/Decision 16): a breaking change to this field set ⇒ bump schema (in lockstep with the npm MAJOR).

Releases (version policy, L6)

  • Format: CHANGELOG.md per Keep a Changelog 1.1.0, [Unreleased] on top, curated user-relevant aggregates. Redundancy rule: no git-log dump, no duplication of Done Index/BACKLOG_ARCHIVE — item/commit history stays in the STEPWELL files. Date format ISO 8601 YYYY-MM-DDTHH:mm (Decision 11).

  • Lockstep SemVer (Decision 16): root, stepwell and stepwell-core always carry the same version. MAJOR = breaking in the tool/JSON/resource contract (always together with the schema field), MINOR = new tools/features, PATCH = fixes. 0.x until the passed field test; 1.0.0 = release moment.

  • Publish checklist: (1) curate Unreleased in the CHANGELOG, (2) bump the version in all three package.json (lockstep), (3) CHANGELOG section [<version>] - <YYMMDD/HHMM>, (4) git tag v<version>, (5) publish only stepwell (npm publish --otp, dist-tag latest; core is distributed as a dependency), (6) CI job pack-smoke must be green — dynamic since 10.5/H1, proves the handshake against the installed artefact (server stepwell).

# Status aggregate — includes the Doc files line (files/lines/bytes, L24/32.7):
# growth is measurable, not invisible
node packages/mcp/src/cli.ts status --root <project> [--json]

# List/filter backlog — icons or ASCII aliases (red/kritisch/p1, hoch/p2, mittel/p3, niedrig/p4, blue/test/p5)
node packages/mcp/src/cli.ts backlog --root <project> [--priority red,yellow] [--open false] [--section HIGH] [--json]

# Progress table — status as icon or alias (open, running/wip, done, blocked)
node packages/mcp/src/cli.ts progress --root <project> [--status done] [--json]

# Consistency check (exit 1 on findings — CI-suitable)
node packages/mcp/src/cli.ts validate --root <project> [--json]

# Mechanically repair validate findings (details: docs_repair in the tool table)
node packages/mcp/src/cli.ts repair --root <project> [--apply] [--json]

# Archive a completed item (dry-run preview, then --apply)
node packages/mcp/src/cli.ts archive --root <project> --id H1 [--note "Commit abc1234"] [--locale en] [--apply]

# Maintain step status (dry-run preview, then --apply) — --title renames the block heading;
# --phase accepts the block name/title or a bare number ("Phase 2" or "2", H8/29.1)
node packages/mcp/src/cli.ts progress-update --root <project> --phase "Phase 2" --step 2.2 --status running [--title "New title"] [--note "…"] [--checkpoint <sha>] [--locale en] [--apply]

# Git workstream sync (details: the Workstreams section below)
node packages/mcp/src/cli.ts sync <status|pull|push> --root <worktree> [--apply] [--json]

Invalid values exit with code 2 and the list of allowed aliases (e.g. 🔴=red/kritisch/p1, …, ⬜=open, 🔄=running/wip, ✅=done, ⛔=blocked).

--root ergonomics (L15/27.8): an explicit --root <dir> stays the precise form; omitting it falls back to the current working directory of the CLI process (so stepwell status just works inside a STEPWELL project). Without --root and without a resolvable project in the CWD, the loader reports PROJECT_NOT_INITIALIZED with setup guidance — exit codes unchanged.

Exit codes: 0 success (or no validate findings) · 1 error or validate findings · 2 usage error (unknown command, missing required option).


CI (optional)

This repo uses GitHub Actions (.github/workflows/ci.yml): install → typecheck → test (JUnit + coverage report as artefact) → validate --root . (exit 1 on doc findings flips the job).

For smaller projects the local run suffices — the pipeline is overkill when nobody looks at it:

npm install && npm run typecheck && npm run test && node packages/mcp/src/cli.ts validate --root .

STEPWELL projects may copy ci.yml as a template; the method (PLAYBOOK) does not require CI.


Warning codes

Parse warnings arise when parsing individual files (drift tolerance), validate findings check cross-file consistency (docs_validate collects both). Convention warnings affect only open files — archives are append-only and never flagged. A UTF-8 BOM (U+FEFF) at the start of a file is silently tolerated (stripped deterministically, T5/9.13) — no warning.

Code

Level

Meaning

PRIO_MISSING

parse

no priority suffix in the title — priority taken from the section emoji

PRIO_DUPLICATE

parse

several priority markers in the title — one is captured

PRIO_UNKNOWN

parse

unknown priority emoji (e.g. 🟣) — priority: "unknown"

BLOCK_UNSTRUCTURED

parse

item without **Label:** bullets — free text captured as text

TITLE_EMPTY

parse

item ID without a title after the separator

STATUS_UNKNOWN

parse

unknown status icon in the table — status: "unknown"

ROW_INCOMPLETE

parse

table row without a status column

NOT_ARCHIVED (D2)

validate

[x] checkbox still hangs in the open BACKLOG → archive_item

ID_DUPLICATE (D5)

validate

item ID appears twice

ID_CONVENTION (D14)

validate

ID violates ^[A-Z][0-9]+$ (series letter + number) — warning, item stays listed

INDEX_WITHOUT_ARCHIVE (D8)

validate

Done Index entry without an archive block (checked across BACKLOG and shard index sections, M24/32.3)

ARCHIVE_WITHOUT_INDEX (D13)

validate

completed archive block ([x]) without a Done Index entry in its paired index — BACKLOG's Done Index for the canonical archive, the shard's own section for shard blocks (M24/32.3); removed blocks (checkbox [ ], via backlog_remove) are deliberately indexless

INDEX_LOCATION (M24/32.3)

validate

index line lives in a different file than its block (strict locality — the line belongs where the block lives); docs_repair reconstructs it into the right file

WIP_WITHOUT_PLAN (D11)

validate

🔄 row without a matching detail block

PHASE_PLANNED (M18/27.9)

validate warning

purely planned phase — block exists, every table step still ⬜ (the progress_plan_phase state); reported, does not flip ok (forward planning is legitimate)

PHASE_MIDWAY (M23/32.5)

validate warning

sequential intermediate state — all ✅ before all ⬜ in table order, no ⛔, none running (the transient window of every step transition); reported, does not flip ok (a docs_validate between flips stays green). True orphaned states (✅ after ⬜, ⛔ island, scope without rows) stay PLAN_WITHOUT_WIP findings

PLAN_WITHOUT_WIP (D12)

validate

detail block without a 🔄 step in a mixed state (✅ + ⬜, none running — orphaned block) or without any table rows in its scope

STEP_DUPLICATE (R6)

validate

step number appears twice in the progress table — progress_update maintains only the first row

EMPTY_MARKER_STALE (H6)

validate

section carries open items and a > No open items. placeholder — lying structure (invariant: placeholder ⟺ section empty; the mutations restore the invariant on add/remove, this finding surfaces pre-tool drift)

DATE_LEGACY (D15)

validate

legacy YYMMDD/HHMM or MM/YYYY date in open files — canonical is ISO 8601 YYYY-MM-DDTHH:mm (e.g. 2026-09-07T15:23)

DEP_CYCLE (M21/30.6)

validate

dependency cycle among open items (Depends on: chain resolves onto itself) — startability is undefined while the cycle stands

DEP_UNKNOWN (M21/30.6)

validate warning

Depends on: reference to an unknown id (not open, archive or Done Index) — ignored for readiness, never blocks

PROJECT_NOT_INITIALIZED (M5)

validate

root without a STEPWELL project (all four files missing) — exactly one finding with guidance instead of an error desert; docs_status returns the zero aggregate + this finding, read/mutation tools a structured error response (code/message/missing). Partial stock (a single file missing) stays a hard error per file. Contract exception: file carries the project root (directory) here, not a file path

Acknowledging a finding in place (L13)

A deliberately accepted deviation is marked on the line the finding points at with *(accepted: CODE[, CODE])* — codes compared case-insensitively (e.g. a legacy Done Index ID: - R1-A — … — done in \d4e5f6a` (accepted: ID_CONVENTION)). Such findings move into acknowledged[](count stays visible) and no longer flipokto false; a new, unmarked finding still blocks. No config file, no extra tool — findings without a line (or without the marker) stay blocking. The marker sits inside the already-tolerated optional(…)` suffix, so titles/IDs stay clean.


Typical workflow (agent + stepwell)

1. docs_status            → where do we stand? Which priorities are open?
2. backlog_list --open    → what is next? (BINDING: sequential by priority)
3. (work on the code, test-first — the agent edits prose directly)
4. progress_plan_phase    → plan a new phase ahead (rows + scope skeleton)
5. progress_update (🔄)   → step started: keep table + detail block clean
6. progress_update (✅)   → step done; if the phase is complete, the block moves into the archive
7. backlog_add/update     → create/change items format-safe (instead of hand-editing)
8. archive_item           → archive the completed item verbatim + Done Index
9. backlog_remove         → move an obsolete item into the archive (without a done marker)
10. docs_validate         → must be clean before committing

The PLAYBOOK rules (sequence, test-first, commit discipline, archive pattern) live in docs/PLAYBOOK.md; the review checklist in docs/LESSONS.md. New to STEPWELL? The five-minute entry point is docs/QUICKSTART.md.


Architecture

Design rule (M4/Decision 17): the tool surface stays small — tools only for concrete structure/read operations, no guide/meta tools; method knowledge lives in PLAYBOOK.md, SKILL.md and the resources. Every new tool (or new parameter surface) justifies the surface growth via the alternative check (parameter on an existing tool/resource instead of a new tool) — documented like the docs_review decision (L5).

Item-aware search — no tool (L19/32.8, alternative check like L5): the question "have we already decided/built this?" is answered today by grep over the doc files plus backlog_show for the block context — grep returns text, backlog_show returns the item status (open/done/removed) and block boundaries. A search tool would build a second source of truth over files that are already the truth (M4). Decision: no tool. Reactivation criterion: field probes repeatedly miss archived hits or reconstruct IDs wrongly — then the minimal candidate is a query parameter on backlog_list (title/ID/text, optional includeArchived: true), hits as { id, status, file, line, snippet } — no fuzzy ranking, no external files, no new tool. The workstream report's predictedOverlap/overlap (H10/30.4) already serve the file-collision variant of the same question.

packages/
├── core/                 stepwell-core — zero dependencies, no MCP dependency
│   ├── src/backlog.ts    BACKLOG parser (sections, item blocks, Done Index)
│   ├── src/progress.ts   PROGRESS parser (table, detail blocks) + scopeSteps
│   ├── src/archive.ts    archive parser (ArchiveItem = BacklogItem + doneLine)
│   ├── src/project.ts    loadProject (4-file requirement, lazy + memoized), backlogShow
│   ├── src/status.ts     docsStatus (aggregate)
│   ├── src/validate.ts   docsValidate (consistency rules + parse warnings)
│   ├── src/mutations.ts  plan/apply: archive_item, progress_update, backlog CRUD, planPhase
│   ├── src/aliases.ts    ASCII aliases for priority emojis and status icons (CLI)
│   ├── src/diff.ts       line-based mini diff for the plan preview
│   ├── src/profile.ts    locale profiles: role synonyms de/en (read union, write canonical)
│   └── tests/fixtures/   project-a (clean) + project-b-drift (cases D1–D15)
│                         + project-d-tablefirst (table before detail blocks),
│                         + project-j-adjacent-blocks (K1: adjacent blocks / mixed EOL),
│                         README there = working specification
├── git/                  stepwell-git — git satellite (H5/Decision 14), depends only on core
│   ├── src/sync.ts       pullTrunk (merge trunk → branch, guards, clean conflict abort)
│   ├── src/push.ts       pushTrunk (ancestor precondition, atomic --ff-only trunk move)
│   ├── src/commit.ts     commitDocs (stages the doc file set: canonical four + existing shards) + message generator
│   ├── src/report.ts     workstreamReport (liveness + overlap, derived from git itself)
│   └── src/preview.ts    syncPreview (dry-run shares the exact guard chain of the real op)
└── mcp/                  stepwell — thin transport layer over core + git satellite
    ├── src/server.ts     createDocsServer (all tools + resources)
    ├── src/tools.ts      tool registration (JSON payloads, isError wrapping)
    ├── src/resources.ts  resource templates (percent-encoded root)
    ├── src/serve.ts      stdio entry
    └── src/cli.ts        stepwell command line

Workstreams — parallel phases via git worktrees (H5, 11/2026)

A project may run phases in parallel as workstreams (PLAYBOOK §1: one phase per git worktree + branch, merge to trunk per step). core stays git-blind — all git intelligence lives in the stepwell-git satellite, offered CLI-first (skill-fed agents need no MCP registration) and MCP-optional (workstream_sync tool).

Per-step ritual (divergence ≤ 1 step):

stepwell sync pull --root <worktree>     # trunk → branch (conflicts surface HERE,
                                         # clean abort + structured report)
# ... implement, verify (typecheck + tests) ...
stepwell progress-update ... --apply --commit   # doc commit: the doc file set (four + shards)
stepwell sync push --root <worktree>     # branch → trunk (--ff-only, precondition:
                                         # trunk head already pulled)
stepwell sync status --root <worktree>   # liveness + overlap of all workstreams

Guards (stable error codes, Decision 10 contract): DIRTY_TREE, DETACHED_HEAD, MERGE_CONFLICT (clean abort, files + per-side commit counts), STALE_BRANCH (re-pull loop), TRUNK_DIRTY, ON_TRUNK_BRANCH, COMMIT_BLOCKED (pre-staged index), COMMIT_FAILED (edits stay applied — never a rollback). Pull/push default to a dry-run preview sharing the exact guard chain of the real operation; push is atomic (--ff-only in the trunk worktree — a trunk move inside the race window becomes a STALE_BRANCH refusal, never a real merge on the trunk side). Worktree/branch creation and cleanup stay agent rituals (one-time setup, no tool). Cleanup hygiene (M16): git worktree remove deregisters but can leave a husk directory when untracked content (e.g. node_modules) survived — verify the directory is gone afterwards; stepwell sync status reports leftovers mechanically (husks[] = stale .git pointer into this repo's admin area, prunable[] = registrations git wants pruned) — resolve with git worktree prune + rm -rf <dir>. Adoption (L14): projects adopting workstreams pin their doc files to deterministic line endings — one glob line in the project-root .gitattributes is enough:

* text=auto eol=lf

Without it, autocrlf differences between machines show up as sync noise (CRLF drift warnings on every cross-machine pull — the four doc files and the method copies are the files every workstream merge touches). Field-test ladder (Decision 14): fixtures → this repo → only an explicitly chosen non-critical project; internal-pwa receives verbatim doc syncs and read-only probes only.

  • Stack: TypeScript (strict, NodeNext, noUncheckedIndexedAccess, exactOptionalPropertyTypes), npm workspaces, Vitest, MCP SDK v1.x stable (^1.30.0) + zod v3. Deliberately decided against build/bundle steps: Node ≥ 22.18 executes the TS source directly (type stripping), import specifiers therefore end on .ts.

  • Data model: ParseResult<T> = { value, warnings[] }, Warning = { code, file, line?, message } — item blocks carry span (lines) and raw (verbatim) as the basis of the verbatim move.

  • Tests: 384 tests, developed test-first (RED → GREEN). Mutations in tests run exclusively against temp copies of the fixtures — the originals are read-only and protected by a test.

Development

npm install && npm run typecheck && npm run test   # acceptance before every completion
npx vitest run packages/core                       # core only
npx vitest run packages/mcp                        # MCP/CLI only

New features follow the STEPWELL method: plan → package in PROGRESS.md → implement test-first → verification → commit → maintain status. Details: AGENTS.md.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      Enables reading and optionally editing existing Markdown files under a configured root folder, including section-level queries, overwrites, appends, deletions, and front matter management, over stdio with no network dependencies.
      2
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI coding agents to consult a project's Git-versioned Markdown knowledge base over local stdio — checking knowledge health, listing the catalog, searching topics, and reading guides before acting. Access stays read-only, so project guidance, decisions, and lessons learned remain shared with human teammates and traceable beside the code.
      4
      1
      MIT