Commit graph

63 commits

Author SHA1 Message Date
Himanshu Dongre
68b3b51661 Attach projects to spaces so sessions stay connected automatically
Smriti previously required passing <space> on every command, and the
repo↔space binding lived only inside a hardcoded SessionStart hook
string. This makes the binding durable and ambient.

- New cli/smriti_cli/attachment.py reads/writes `.smriti.json` at the
  repo root — a committed file that binds the repo to a space and
  travels with it (repo A→space A, repo B→space B).
- The <space> positional is now optional on state, current, metrics,
  checkpoint create/list, claim create/list, and worktree open/list.
  When omitted it resolves from the nearest `.smriti.json`, walking up
  from the working directory, so any session opened inside the repo
  stays connected without re-passing the space.
- `smriti init` writes `.smriti.json` and binds the space's backend
  project_root to the checkout. The generated SessionStart hook is now
  space-less (`smriti state --compact`) — identical across every
  project and stable when a project is re-attached.
- New `smriti status` command: a day-two continuity check showing the
  attachment, backend health, and open work.
- CLI api_url also resolves from the attachment as a last-resort
  default, behind --api-url and SMRITI_API_URL.

MCP tool signatures are intentionally unchanged this sprint.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 00:10:50 +05:30
Himanshu Dongre
ab8d6f6b6f Clarify claim completion metrics 2026-05-18 00:07:42 +05:30
Himanshu Dongre
eb60d03f4b Render list-valued blocked_by consistently in state --compact
`smriti current` already normalizes a list-valued blocked_by to a clean
comma-separated string via the backend CurrentTask validator, but `smriti
state` rendered it through an f-string and leaked the raw Python list repr
(['a', 'b']) into the state brief — the surface agents read at session start.

Add a `_coerce_blocked_by` helper in the CLI formatters mirroring that
validator, and apply it in `_normalize_task_item` so every `smriti state`
task line renders blocked_by the same way `smriti current` does. Adds
regression tests.
2026-05-18 00:02:07 +05:30
Himanshu Dongre
c43310caa1 Make doctor runtime checks external-project aware 2026-05-17 19:16:56 +05:30
Himanshu Dongre
76f6f4c2c7 Polish external validation output and docs 2026-05-17 12:15:14 +05:30
Himanshu Dongre
2ac2abcfae Handle SQLite checkpoint timestamps in CLI formatters 2026-05-17 11:22:30 +05:30
Himanshu Dongre
98edf48a5d Merge doctor-activation and init portability into the activation sprint 2026-05-17 10:50:01 +05:30
Himanshu Dongre
1afca2bda2 Add smriti quickstart and a shipped demo space
A fresh install opens to an empty space, so Smriti's value — which only
shows once reasoning has accumulated — is invisible on day one. `smriti
quickstart` seeds one small, finished project (a rate-limiting feature
built by two agents, with a branch explored and dropped) and prints a
short guided walkthrough.

The demo space `smriti-demo` carries a marker in its description: --remove
only deletes a marked space, --reset rebuilds it, and seeding rolls back a
half-built space on failure. The fixture is plain structured data with
content-integrity tests guarding counts, intent types, note kinds, the
demo marker, and branch divergence.
2026-05-17 10:49:52 +05:30
Himanshu Dongre
5c31d3d0f0 Preserve init API URL in hooks and MCP hints 2026-05-17 00:52:24 +05:30
Himanshu Dongre
ae9d367c08 Make init startup hooks portable 2026-05-17 00:49:44 +05:30
Himanshu Dongre
448484c4c3 Expand doctor activation diagnostics 2026-05-17 00:26:03 +05:30
Himanshu Dongre
f4062da76e Sync docs and regenerate skill pack for the current product surface
Packaging/readiness pass — documentation only, no feature or behavior change.

- REPO_STRUCTURE.md, CONTRIBUTING.md: corrected test counts (156 integration,
  133 unit, 151 CLI), local-first setup flow (make setup-local / dev-local),
  command count, new routes/types/test files.
- README.md: refreshed dogfood metrics, added Project Current State and
  smriti doctor to the surfaces, SQLite to the tech stack.
- cli/README.md: MCP tool count 17 -> 21 (added the four worktree tools),
  documented the smriti worktree commands.
- ARCHITECTURE.md: API table now lists the Project Current State and metrics
  endpoints; new Database modes section (local SQLite / Postgres).
- DECISIONS.md: recorded the local-first SQLite mode and Project Current
  State surface decisions.
- AGENTS.md: regenerated from skill pack template v2.3 (was a stale v1.5
  render); the .claude/ claude-code render was likewise refreshed locally.

.env.example, docs/DEMO_SCRIPT.md, and CLAUDE.md were reviewed and left as-is.
2026-05-17 00:03:59 +05:30
Himanshu Dongre
8388bf8a1f Add local-first setup onboarding 2026-05-16 22:39:38 +05:30
Himanshu Dongre
704f28570c Add Project Current State CLI surface 2026-05-16 20:55:01 +05:30
Himanshu Dongre
7c8f259342 Add smriti doctor CLI diagnostics 2026-05-16 20:29:02 +05:30
Himanshu Dongre
c470947477
Polish worktree short ids and clean finish (#5) 2026-05-04 15:28:19 +05:30
Himanshu Dongre
8c963198e1 Add canonical project root for spaces 2026-05-04 13:43:44 +05:30
Himanshu Dongre
3cb514b279 Add V3 dirty paths and skill pack v2.1 2026-05-04 13:11:20 +05:30
Himanshu Dongre
1bab89cdea Populate worktree list probe columns 2026-05-04 12:52:35 +05:30
Himanshu Dongre
39003a8aa6 Add V2 worktree-bound claims 2026-05-04 12:16:32 +05:30
Himanshu Dongre
b5ccdce758 Add V1 worktree primitive
Adds WorkTree schema and migration, /api/v5/worktrees CRUD, CLI and MCP worktree surfaces, targeted regression tests, health capability, and minimal docs. Live Postgres migration/manual localhost verification intentionally remain pending until the full backend provider-config gate is resolved.
2026-05-04 00:58:30 +05:30
Himanshu Dongre
64caf0c801 Add space metrics endpoint and sync docs with current product surface
Metrics: GET /api/v5/metrics/spaces/{id} returns coordination (checkpoints,
agents, cross-agent continuations, claim completion rate), state quality
(decisions/tasks per checkpoint, structured task adoption, milestones),
and branch lifecycle KPIs. All computed on demand from existing data —
no new schema, no events, no background jobs. CLI: smriti metrics <space>.

Doc sync: fix stale tool counts (CONTRIBUTING 15→17, cli/README 16→17),
update REPO_STRUCTURE (skill pack v1.5→v1.9, test files/counts), remove
shipped branch-lifecycle from ARCHITECTURE "not yet" section, add task
IDs + task-referenced claims + capabilities manifest + recheck pattern
to ARCHITECTURE structured tasks section, add coordination primitives
summary to README.
2026-04-14 01:11:56 +05:30
Himanshu Dongre
beae3b5c9b Add stable task IDs and task-referenced claims for collision detection
Tasks gain an optional id field (short slug like "impl-1", "docs-arch").
Claims gain an optional task_id field referencing a specific task. The
state brief shows (id: X) on tasks and (task: X) on claims, making it
precise which task a claim covers.

Skill pack v1.9 teaches the recheck pattern: after creating a claim,
re-read state to detect if another agent claimed the same task_id in
the race window. If collision detected, abandon and pivot.

This solves the near-simultaneous start problem from the autonomy
validation where both agents picked [docs] because claims had no
task-level identity.
2026-04-14 00:16:46 +05:30
Himanshu Dongre
6da93ae856 Add capabilities manifest to /health for stale-backend detection
The health endpoint now returns git_sha and a capabilities list so
agents can detect when the running backend is missing features they
need (e.g., claims, structured_tasks). Skill pack v1.8 teaches the
capabilities probe: check /health when a 404 or missing section
suggests the backend is stale, tell the human to restart.

Diagnosed from the autonomy validation where Codex hit a backend
without /api/v5/claims — the backend process was running old code.
2026-04-13 23:06:34 +05:30
Himanshu Dongre
73f26e721c Add structured tasks with intent hints for autonomous work selection
Tasks in checkpoints evolve from flat strings to objects with optional
intent_hint (implement/review/investigate/docs/test), blocked_by
(dependency label), and status (open/done). Agents reading the state
brief can now self-select complementary work by matching task intents
against active claim intent_types — no founder routing needed.

Backward-compatible: old string tasks normalize at render time. No
schema migration. JSONB handles both shapes. Skill pack v1.7 teaches
the autonomous selection reflex.
2026-04-13 22:27:32 +05:30
Himanshu Dongre
ae94d73ad3 Skill pack v1.6: teach checkpoint notes, fix stale tool count (16→17) 2026-04-13 20:52:49 +05:30
Himanshu Dongre
9b109ae94c Add checkpoint notes: additive founder annotations with kind (note/milestone/noise) 2026-04-13 19:10:37 +05:30
Himanshu Dongre
a3b570e609 Add freshness check section to cli/README agent workflow walkthrough 2026-04-13 18:52:33 +05:30
Himanshu Dongre
51cc91ec60 Teach freshness reflex in skill pack: check --since before checkpointing 2026-04-13 18:22:14 +05:30
Himanshu Dongre
44db645460 Add --since freshness parameter to smriti state for pull-time staleness detection 2026-04-13 18:05:05 +05:30
Himanshu Dongre
208f04ebda Fix stats honesty: compute from actual rendered sections, never silently no-op 2026-04-13 16:28:50 +05:30
Himanshu Dongre
c613e45512 Add --stats flag for compact-mode savings measurement 2026-04-13 16:11:45 +05:30
Himanshu Dongre
5a3ea976ed Adopt compact mode as default for startup state injection across all surfaces 2026-04-13 15:58:40 +05:30
Himanshu Dongre
b8e6e0403d Add --compact mode to smriti state: artifact labels only with recovery instruction 2026-04-13 15:37:41 +05:30
Himanshu Dongre
4ddd0e2ef7 Sync docs: 15->16 MCP tools, add init+branch to REPO_STRUCTURE, add smriti_close_branch to tools table 2026-04-13 14:41:41 +05:30
Himanshu Dongre
3a98e9daa5 Add smriti init for one-step agent onboarding 2026-04-13 14:25:42 +05:30
Himanshu Dongre
0e1f3de8af Add CLI and MCP tests for branch close 2026-04-13 13:37:06 +05:30
Himanshu Dongre
878b550ebd Default branch close disposition to integrated 2026-04-13 13:18:34 +05:30
Himanshu Dongre
405592da55 Add branch disposition for lifecycle closure: integrated, abandoned, active 2026-04-13 13:03:22 +05:30
Himanshu Dongre
2f98a31323 Fix stale MCP tool counts: 13->15 across all docs 2026-04-13 11:09:17 +05:30
Himanshu Dongre
ab192c48a8 Fix REPO_STRUCTURE accuracy and add runtime freshness rule to skill pack 2026-04-13 00:28:16 +05:30
Himanshu Dongre
8ce495e3d7 Show full claim UUID in CLI and MCP output 2026-04-12 23:56:39 +05:30
Himanshu Dongre
34166e517b Document claim subcommand and MCP tools in cli README 2026-04-12 23:46:56 +05:30
Himanshu Dongre
6f52770b8e Teach work-claim reflex in skill pack v1.5 2026-04-12 23:35:53 +05:30
Himanshu Dongre
011af9bba6 Add work claims for pre-work intent visibility 2026-04-12 23:22:38 +05:30
Himanshu Dongre
17c236ce35 Document shared runtime model for multi-agent local development 2026-04-12 22:24:56 +05:30
Himanshu Dongre
7a2443c4bf Add clean-start and clean-finish rules to skill pack v1.3 2026-04-12 21:02:37 +05:30
Himanshu Dongre
6aab2165d9 Update skill pack to v1.2 with repo reconciliation rule 2026-04-12 19:55:45 +05:30
Himanshu Dongre
bea192d25d Update Smriti skill pack for cross-agent continuation 2026-04-12 11:50:39 +05:30
Himanshu Dongre
299382b6bf Document skill pack and multi-branch state as the V4 surfaces
cli/README.md:
- Add an "Installing the Smriti skill pack" subsection between the MCP
  server section and the Commands reference. Walks through the target
  list (claude-code, codex), the CLI install flow, the MCP-tool flow
  (read the returned markdown, write via host file tools), and the
  verification criterion ("agent calls state unprompted, never writes
  HANDOFF.md").
- Update the MCP tools table to 13 entries (add smriti_install_skill).
- Update the Commands reference to include smriti skills list/show/
  install and the new --main-only flag on smriti state.
- Update the "Using Smriti from a coding agent" walkthrough to note
  multi-branch state as the default, with caps and the --main-only
  escape hatch.

README.md (root):
- Expand the agent-facing surfaces section to list four surfaces, not
  three: chat UI, CLI, MCP server, agent skill pack. Explain what the
  skill pack does in one paragraph.
- Update the "Where this is going" outlook to acknowledge that the
  transport gap is closed, the fluency gap is what the skill pack
  addresses, and the open questions are now shape questions.

DECISIONS.md:
- Add "Why skill packs are a first-class surface, not documentation" —
  records the reasoning for shipping versioned instruction files into
  agent host project directories rather than a docs site, and explains
  why Section 5 ("When NOT to checkpoint") gets equal weight to "When
  to checkpoint."
- Add "Why smriti state is multi-branch by default" — records why the
  default was flipped, what the hard caps are, that divergence
  detection reuses the compare normalization, and that --main-only /
  main_only=True preserves the legacy path for scripts.

ARCHITECTURE.md:
- Split the agent-facing backend section into runtime surfaces (CLI,
  MCP, chat UI) and the onboarding surface (skill pack) to make the
  distinction between how agents call Smriti and how they learn to
  call Smriti explicit.
- Expand the CLI + MCP surface descriptions to reference the new V4
  state endpoint and the new smriti_install_skill MCP tool (13 tools
  now).
- Add a "Multi-branch state" subsection documenting the new endpoint,
  the hard caps, the reuse of _diff_lists from lineage, and the
  backward-compat story via --main-only / main_only=True.
- Update the API versioning table to note /api/v4/chat/spaces/{id}/state
  as the agent-facing default alongside /head.
2026-04-12 02:14:35 +05:30