Skip to content

Add a machine-readable client wiring receipt: midas init/status --json - #16

Merged
vornicx merged 1 commit into
mainfrom
claude/midas-issue-15-3wlmof
Jul 4, 2026
Merged

vornicx merged 1 commit into
mainfrom
claude/midas-issue-15-3wlmof

Conversation

@vornicx

@vornicx vornicx commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Closes #15.

What

midas init, midas init --dry-run, and midas status now take --json, emitting a compact machine-readable client wiring receipt instead of the text UI (which stays byte-identical without the flag).

midas status --json
{
  "midas_version": "0.1.1",
  "receipt_kind": "client_wiring",
  "generated_at": "2026-07-04T18:41:36Z",
  "memory_db": "/home/user/.midas/memory.sqlite3",
  "scope_mode": "shared",
  "namespace": null,
  "server_command": "midas-mcp",
  "embedder": "local",
  "policy": {
    "recall_first": true,
    "capture_enabled": true,
    "min_importance": 2,
    "dedup_threshold": 0.95,
    "external_or_destructive_actions_require_check_memory_use": true
  },
  "clients": [
    {"client": "Claude Code", "config_path": "/home/user/.claude.json", "detected": true,
     "wired": true, "server_command": "midas-mcp", "client_id": "claude-code",
     "namespace": null, "reason": null},
    {"client": "Cursor", "config_path": "/home/user/.cursor/mcp.json", "detected": false,
     "wired": false, "server_command": null, "client_id": null, "namespace": null,
     "reason": "config not found"}
  ],
  "warnings": [],
  "store": {"exists": true, "records": 12, "live": 11, "size_kb": 96}
}

How

  • init --json reports, per client: config_path, detected, wired, changed, backup_path, reason — including clients that were skipped (CLI not installed, config not found) instead of silently omitting them. Dry runs are marked "dry_run": true, never change anything, and carry the planned action in reason.
  • status --json goes beyond the substring check: it parses each client config (JSON mcpServers, and codex TOML via tomllib) and reports the actual command + MIDAS_* env that client will launch with — so the receipt states which memory/scope every configured client got, not just "wired". Only MIDAS_* env keys are surfaced, keeping anything else a user added out of the artifact.
  • scope_mode (shared / project-scoped / manual-namespace) is derived from the wired clients' namespaces; disagreeing clients produce "mixed" plus an explicit warning rather than being hidden.
  • The receipt is a stable audit boundary: config paths, command/env, scope, and the enforced policy — never prompts, records, or memory contents (per the issue's scope section).

Tests

  • New tests cover: dry-run receipt shape and the skipped-clients invariant; a real (sandboxed via tmp_path) init that wires Cursor and then proves the same wiring back through status --json (the issue's one-command invariant); codex TOML parsing; the missing-store warning; and all _derive_scope branches.
  • 283 passed, 5 skipped across the full suite; human output of init/status verified unchanged; ruff clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Deray2qcPRy1hZVQnboHp4


Generated by Claude Code

#15)

One command now yields a compact, pasteable proof of what was wired and
where: per client its config path, detected/wired/changed state, backup
path and skip reason; plus the memory DB, scope mode, server command,
embedder, and the enforced policy. `status --json` parses each client
config (JSON mcpServers and codex TOML) to report the actual command +
MIDAS_* env every client will launch with, and warns when clients
disagree on namespaces. Config paths and scope/policy only — never
memory contents. Human output of both commands is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Deray2qcPRy1hZVQnboHp4
@vornicx
vornicx merged commit 30b80a2 into main Jul 4, 2026
2 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.

Add a machine-readable client wiring receipt for init/status

2 participants