skillwiki 0.10.104 → 0.10.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1042,6 +1042,84 @@ if [ ! -f "$SNAPSHOT_WORKTREE/index.md" ]; then
1042
1042
  exit 1
1043
1043
  fi
1044
1044
 
1045
+ # --- Post-sync direct-S3 log append race ---
1046
+ # An MCP log.md append that lands after the pre-sync parity wait (or after the
1047
+ # post-repair sync) leaves S3 log.md strictly longer than the worktree copy.
1048
+ # The post-sync gate has already refreshed expectations from direct S3. Compare
1049
+ # those bytes with the worktree before running the terminal parity gate. Only a
1050
+ # strict append of log.md with an unchanged index.md permits one more sync.
1051
+ snapshot_post_sync_log_append_race_detected() {
1052
+ [ -n "$PROJECTION_STATE_DIR" ] || return 1
1053
+ [ -f "$SNAPSHOT_WORKTREE/index.md" ] || return 1
1054
+ [ -f "$SNAPSHOT_WORKTREE/log.md" ] || return 1
1055
+ if ! cmp -s "$SNAPSHOT_WORKTREE/index.md" "$PROJECTION_STATE_DIR/expected-index.md"; then
1056
+ log "post-sync log-append race: current store index.md differs from worktree index.md; no additional sync"
1057
+ return 1
1058
+ fi
1059
+ if ! snapshot_projection_log_is_store_ahead "$SNAPSHOT_WORKTREE/log.md" "$PROJECTION_STATE_DIR/expected-log.md"; then
1060
+ log "post-sync log-append race: current store log.md is not a strict prefix extension of worktree log.md; no additional sync"
1061
+ return 1
1062
+ fi
1063
+ return 0
1064
+ }
1065
+
1066
+ # Run one additional full rclone sync with the existing RCLONE_OPTS, then repeat
1067
+ # delete-intent reconciliation, re-read the current store, and re-run the
1068
+ # existing exact worktree parity and semantic preview gates. Returns 0 only when
1069
+ # the recovery converged; the caller refuses (without a second retry) otherwise.
1070
+ snapshot_retry_sync_after_log_append_race() {
1071
+ local context="${1:-post-sync}"
1072
+ if ! rclone sync "$CLOUD_REMOTE" "$SNAPSHOT_WORKTREE" "${RCLONE_OPTS[@]}" --stats 10s 2>&1 | tee "$RCLONE_LOG"; then
1073
+ log "ERROR: $context log-append race retry rclone sync failed"
1074
+ tail -50 "$RCLONE_LOG" >> "$LOG_FILE" 2>/dev/null || true
1075
+ rm -f "$RCLONE_LOG"
1076
+ return 1
1077
+ fi
1078
+ rm -f "$RCLONE_LOG"
1079
+ log "post-sync log-append race detected; performed one additional rclone sync context=$context"
1080
+ if ! snapshot_reconcile_delete_intents; then
1081
+ log "ERROR: $context log-append race retry delete-intent reconciliation failed"
1082
+ return 1
1083
+ fi
1084
+ snapshot_gate_projection_candidate \
1085
+ "FAIL $context log-append race retry projection expectation refresh; snapshot promotion refused" \
1086
+ "FAIL $context log-append race retry projection candidate verification; snapshot promotion refused"
1087
+ }
1088
+
1089
+ # Post-sync projection gate with at most one log-append-race recovery.
1090
+ # A first failure that is not the recoverable log-append shape (or that does not
1091
+ # converge after the single retry) is logged as the terminal refusal.
1092
+ snapshot_gate_projection_candidate_with_race_retry() {
1093
+ local context="${1:-post-sync}"
1094
+ local refresh_fail="$2"
1095
+ local verify_fail="$3"
1096
+ if ! snapshot_refresh_projection_expectations_from_store; then
1097
+ log "$refresh_fail"
1098
+ return 1
1099
+ fi
1100
+ # Exact byte parity is the ordinary path. Its semantic preview is terminal:
1101
+ # a later append must not turn a preview failure into a retry.
1102
+ if [ -z "$PROJECTION_STATE_DIR" ] \
1103
+ || { cmp -s "$PROJECTION_STATE_DIR/expected-index.md" "$SNAPSHOT_WORKTREE/index.md" \
1104
+ && cmp -s "$PROJECTION_STATE_DIR/expected-log.md" "$SNAPSHOT_WORKTREE/log.md"; }; then
1105
+ if snapshot_verify_projection_candidate; then
1106
+ return 0
1107
+ fi
1108
+ log "$verify_fail"
1109
+ return 1
1110
+ fi
1111
+ if ! snapshot_post_sync_log_append_race_detected; then
1112
+ snapshot_verify_worktree_projection_parity || true
1113
+ log "$verify_fail"
1114
+ return 1
1115
+ fi
1116
+ if snapshot_retry_sync_after_log_append_race "$context"; then
1117
+ return 0
1118
+ fi
1119
+ log "$verify_fail"
1120
+ return 1
1121
+ }
1122
+
1045
1123
  # --- Delete-intent no-resurrect ---
1046
1124
  # Git is SSOT for intentional absences. After S3→worktree sync, strip any path
1047
1125
  # that has an active tombstone on origin/main and optionally prune S3.
@@ -1195,7 +1273,8 @@ snapshot_reconcile_delete_intents() {
1195
1273
  if ! snapshot_reconcile_delete_intents; then
1196
1274
  exit 1
1197
1275
  fi
1198
- if ! snapshot_gate_projection_candidate \
1276
+ if ! snapshot_gate_projection_candidate_with_race_retry \
1277
+ "post-sync" \
1199
1278
  "FAIL projection expectation refresh after sync; snapshot promotion refused" \
1200
1279
  "FAIL projection candidate verification; snapshot promotion refused"; then
1201
1280
  exit 1
@@ -1270,7 +1349,8 @@ if [ "$needs_repair" = true ]; then
1270
1349
  if ! snapshot_reconcile_delete_intents; then
1271
1350
  exit 1
1272
1351
  fi
1273
- if ! snapshot_gate_projection_candidate \
1352
+ if ! snapshot_gate_projection_candidate_with_race_retry \
1353
+ "post-repair" \
1274
1354
  "FAIL post-repair projection expectation refresh after sync; snapshot promotion refused" \
1275
1355
  "FAIL post-repair projection candidate verification; snapshot promotion refused"; then
1276
1356
  exit 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.10.104",
3
+ "version": "0.10.105",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "skillwiki": "dist/cli.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.10.104",
3
+ "version": "0.10.105",
4
4
  "skills": "./",
5
5
  "description": "Project-aware Karpathy-style knowledge base for Claude Code: 22 prompt-only skills (wiki-*, proj-*, using-skillwiki, skillwiki-mcp, skillwiki-connect) backed by the deterministic `skillwiki` CLI.",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.10.104",
3
+ "version": "0.10.105",
4
4
  "description": "Project-aware Karpathy-style knowledge base for Codex with 22 prompt-only skills backed by the deterministic skillwiki CLI.",
5
5
  "author": {
6
6
  "name": "karlorz",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.10.104",
3
+ "version": "0.10.105",
4
4
  "description": "Project-aware Karpathy-style knowledge base: 22 prompt-only skills (wiki-*, proj-*, using-skillwiki, skillwiki-mcp, skillwiki-connect) backed by HTTP MCP wiki_capture.",
5
5
  "author": {
6
6
  "name": "karlorz"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillwiki/skills",
3
- "version": "0.10.104",
3
+ "version": "0.10.105",
4
4
  "private": true,
5
5
  "files": [
6
6
  "wiki-*",
@@ -14,7 +14,7 @@ SkillWiki captures are HTTP MCP only (`type: http`). Claude/Grok use `SKILLWIKI_
14
14
  ## First-run readiness
15
15
 
16
16
  - Resolve the installed plugin root from `GROK_PLUGIN_ROOT`, falling back to `CLAUDE_PLUGIN_ROOT`, and run `python3 "$PLUGIN_ROOT/scripts/check_readiness.py" --apply --json` before the first SkillWiki MCP call.
17
- - **Cursor / Grok Bot:** the Cursor-native plugin requires `SKILLWIKI_MCP_TOKEN` under **Plugins → Configure**. Optional non-secret `SKILLWIKI_EXTRA_VAULTS` (comma-separated vault ids such as `wiki-fin`) opts the client into extra vaults on the **same** connector URL. It is not a second connector, not a secret, and not written to `~/.cursor/mcp.json` or Grok `config.toml`. Server `allowed_vaults` remains the security boundary; an extra listed here but missing from the bearer still fails closed. Omit `vault=` on tools to use the handshake `default_vault` (central). Grok Bot does not inherit Mac process env or `~/.cursor/mcp.json`. `failed_to_load` with no token box means this package is missing; after this package is installed, Configure is the token field (same pattern as grok-search).
17
+ - **Cursor / Grok Bot:** the Cursor-native plugin requires `SKILLWIKI_MCP_TOKEN` under **Plugins → Configure**. Optional non-secret `SKILLWIKI_EXTRA_VAULTS` (comma-separated vault ids such as `wiki-fin`) opts the client into extra vaults on the **same** connector URL. It is not a second connector, not a secret, and not written to `~/.cursor/mcp.json` or Grok `config.toml`. Server `allowed_vaults` remains the security boundary; an extra listed here but missing from the bearer still fails closed. Omit `vault=` on tools to use the live handshake `default_vault`; specify an extra vault only when requested. Grok Bot does not inherit Mac process env or `~/.cursor/mcp.json`. `failed_to_load` with no token box means this package is missing; after this package is installed, Configure is the token field (same pattern as grok-search).
18
18
  - `missing_prereq` means `SKILLWIKI_MCP_TOKEN` is absent from process environment; stop and ask for a bearer. Do not invent a stdio MCP.
19
19
  - A new host (a machine that should write the wiki for the first time) needs an issued host-id bearer before handshake can pass. The operator runs `skillwiki mcp-auth issue-host --host-id <id> --write` on metal (TTY required). Connector hosts put the printed value into process env or host Configure. Unknown agents (no plugin / no usable connector) ingest a chat-attached env file with `skillwiki connect --from-file` (or `--from-stdin`); do not instruct paste-into-chat. Do not auto-write `mcp.env`, `mcp.json`, or Grok `config.toml`. Do not invent a second admin skill. A local vault/FUSE mirror is optional.
20
20
  - First-run order: install plugin/CLI → operator issues on metal → connector Configure **or** unknown-agent `skillwiki connect --from-file <attachment>` → **new session** → `skillwiki doctor --check-mcp` → one write (`wiki_capture`, work-item write, or page publish).
@@ -32,7 +32,9 @@ Remotes still on a pre-HTTP-MCP plugin or CLI must upgrade the plugin channel (a
32
32
 
33
33
  On leaf hosts, wiki captures go through MCP. Do **not** write `raw/transcripts/` or `log.md` as local files.
34
34
 
35
- 1. Call MCP `wiki_capture` with `kind` (`task` | `idea` | `bug` | `note`), `project`, `title`, and `content`. Optional `agent_note`.
35
+ Check the successful write receipt's `vault_id` against the intended vault before reporting any write as saved.
36
+
37
+ 1. Call MCP `wiki_capture` with `kind` (`task` | `idea` | `bug` | `note`), `project`, `title`, and `content`. Optional `agent_note`. Verify its returned `path` with `wiki_read_page` in that vault.
36
38
  2. Call MCP `wiki_log_append` when a structural `log.md` line is needed. Pass append-only `content` (optional `operation_id` is 64 hex). Success returns a receipt (`operation_id`, `event_path`, hashes, `s3_verified`). Verify the exact block via `wiki_read_page(event_path)`. Do not require reading `log.md`. If `log.md` is over 256 KiB, full `wiki_read_page("log.md")` returns `PAGE_TOO_LARGE`; use `tail_bytes` only to browse the newest end.
37
39
  3. **Feature-detect work-item and page-publish tools**:
38
40
  - When the server advertises `wiki_workitem_write`: use it to create, mutate, or close work items under `projects/<slug>/work/**` or update `projects/<slug>/knowledge.md`, and to save Layer-3 workspace markdown: `projects/<slug>/README.md`, `projects/<slug>/architecture/**/*.md`, `projects/<slug>/requirements/**/*.md`, `projects/<slug>/compound/**/*.md`. Pass `path`, `content`, and `base_sha256` of existing bytes (from `wiki_read_page` or local mirror). On `FILE_CHANGED`, re-read and retry once. Deployed servers that predate the workspace-family allowlist deny those paths — treat that `PATH_DENIED` as "server predates this release"; STOP, do not fall back.
@@ -1,98 +1,90 @@
1
1
  # SkillWiki Activation
2
2
 
3
- You have SkillWiki - a project-aware knowledge-base CLI + skill suite for agent harnesses.
4
- This file is loaded at session start. For full operational detail, invoke `/using-skillwiki`.
3
+ SkillWiki is the project-aware knowledge base and skill suite. This file is
4
+ session-start routing context; invoke `using-skillwiki` for full instructions.
5
5
 
6
- ## CLI Probe
6
+ ## Route
7
7
 
8
- If `skillwiki --help` fails, the CLI is unavailable. Degrade to manual file ops (grep/find) for read-only queries. Fail closed for managed mutations - never write typed pages, index, or log directly.
8
+ Use SkillWiki for vault or wiki work: setup, capture, ingestion, search, health,
9
+ provenance, lifecycle, project workspaces, decisions, sync, or graphing.
10
+ Choose the matching installed skill:
9
11
 
10
- ## When to Route
12
+ - Setup and input: `wiki-init`, `wiki-ingest`, `wiki-add-task`,
13
+ `wiki-adapter-prd`, `skillwiki-connect`.
14
+ - Read and maintain: `wiki-query`, `wiki-lint`, `wiki-audit`,
15
+ `wiki-crystallize`, `wiki-reingest`, `wiki-archive`, `wiki-remove`.
16
+ - Projects and planning: `proj-init`, `proj-work`, `proj-distill`,
17
+ `proj-decide`, `wiki-gate-plan-mode`, `dev-loop:research`.
18
+ - Fleet and visualization: `wiki-sync`, `wiki-canvas`.
19
+ - HTTP MCP capture or append: `skillwiki-mcp`.
11
20
 
12
- Invoke a SkillWiki skill when the user: wants vault/wiki/knowledge-base operations, ingests sources or URLs, searches/queries vault content, runs health checks or lint, crystallizes a session, works with project workspaces/ADRs, captures ideas/bugs/tasks, archives pages, removes paths, detects source drift, ingests foreign PRD formats, syncs vault git, or visualizes the vault graph.
21
+ If routing is unclear, invoke `using-skillwiki` rather than guessing.
13
22
 
14
- ## Skill Map
23
+ ## CLI and Planning
15
24
 
16
- | Skill | When to Invoke |
17
- |-------|----------------|
18
- | `wiki-init` | Bootstrap a vault |
19
- | `wiki-ingest` | Convert URLs/files/text into typed-knowledge pages |
20
- | `wiki-query` | Search typed knowledge |
21
- | `wiki-lint` | Vault health and lint checks |
22
- | `wiki-crystallize` | Distill current session into a typed page |
23
- | `wiki-audit` | Verify raw provenance and source integrity |
24
- | `wiki-archive` | Archive typed pages or preserve-move raw sources |
25
- | `wiki-remove` | Hard-delete vault paths without snapshot resurrection |
26
- | `wiki-reingest` | Detect source drift and re-ingest updated content |
27
- | `wiki-add-task` | Quick-capture ideas, bugs, tasks, notes (HTTP MCP on leaf hosts; local files on authoring hosts) |
28
- | `skillwiki-mcp` | HTTP MCP captures (`wiki_capture`, `wiki_log_append`); never local writes on leaf hosts |
29
- | `skillwiki-connect` | Unknown-agent HTTP MCP connect: `skillwiki connect --from-file` (never paste-into-chat) |
30
- | `wiki-adapter-prd` | Map foreign PRD formats (CodeStable, RFC, AIDE, Hermes) |
31
- | `wiki-sync` | Safely sync vault git repository |
32
- | `wiki-canvas` | Generate Obsidian Canvas visualization |
33
- | `wiki-gate-plan-mode` | Toggle EnterPlanMode gating for brainstorming then proj-work |
34
- | `proj-init` | Bootstrap a project workspace |
35
- | `proj-work` | Open or run a work item |
36
- | `proj-distill` | Distill project compound entries into concept pages |
37
- | `proj-decide` | Write an Architectural Decision Record (ADR) |
38
- | `dev-loop:research` | Research scan of repo + vault health |
25
+ If `skillwiki --help` fails, use local tools only for read-only inspection and
26
+ fail closed for managed mutations.
39
27
 
40
- ## PRD Bridge
28
+ After architectural design approval, invoke `proj-work` and put `spec.md` in
29
+ that work item. Do not invoke `writing-plans`. Do not git commit from
30
+ brainstorming. Use standalone `test-driven-development` for bounded TDD. For UI
31
+ work, offer `visual-companion.md` once. Never create `docs/superpowers/`.
41
32
 
42
- After architectural design approval, invoke `proj-work` then write `spec.md` in that work folder. Do not invoke `writing-plans`. Do not git commit from brainstorming. Bounded TDD uses standalone `test-driven-development` when installed. For UI work, offer brainstorming `visual-companion.md` once (optional). Never create `docs/superpowers/` in any repo.
33
+ Workflow profiles are `native`, `guided`, and explicit-only `full`; selection
34
+ is `adaptive` or `fixed`. Installation or cache discovery proves availability,
35
+ not activation. Native and guided do not force Superpowers or plan-mode gating.
36
+ Only a full profile may use its configured provider flow. Invalid fixed policy
37
+ fails closed; noninteractive sessions do not prompt. Keep workflow profile,
38
+ PRD provider and stage, SkillWiki provenance, and simplify review independent.
43
39
 
44
- ## Workflow Profiles
40
+ ## Managed-Write Safety
45
41
 
46
- Resolve workflow policy before loading provider skills. Profiles are `native`,
47
- `guided`, and explicit-only `full`; selection is `adaptive` or `fixed`.
48
- Adaptive chooses only native or guided. Installation and cache discovery prove
49
- availability, never activation. Native and guided do not force Superpowers or
50
- plan-mode gating. Explicit full may use the complete configured provider flow;
51
- gate plan mode only when that flow actually uses Superpowers/TDD planning.
52
- Invalid fixed policy is unresolved and fail-closed. Noninteractive sessions do
53
- not prompt. Keep workflow profile, `prd_layer` provider, `prd_pipeline` stage
54
- template, SkillWiki provenance, and the independent simplify review gate as
55
- separate concerns.
42
+ The HTTP MCP contract below controls remote reads and mutations. On leaf hosts,
43
+ captures use MCP, never local `raw/transcripts` or `log.md` writes. Project
44
+ workspace writes use `wiki_workitem_write` with compare-and-swap; stop if the
45
+ tool or path family is unavailable. A wiki push or rclone copy is not a managed
46
+ write and is not visible until the authoritative snapshot. Never use bare `rm`
47
+ or `git rm` for fleet deletion. Never auto-install SkillWiki in unattended
48
+ sessions. If required publish support is unavailable, fail closed.
56
49
 
57
- ## Fail-Closed Boundary
58
-
59
- Never write typed pages, `index.md`, or `log.md` directly. On leaf hosts, captures use HTTP MCP (`wiki_capture`), never local `raw/transcripts` or `log.md` writes. Project workspace saves (`projects/<slug>/README.md`, `architecture/`, `requirements/`, `compound/` — `.md` only) go through MCP `wiki_workitem_write` CAS; feature-detect and STOP if the tool is absent or the deployed server predates the workspace-family allowlist (`PATH_DENIED`). wiki-push / rclone is never an agent writer — an S3-only copy is invisible to `wiki_read_page` until the sg01 snapshot; never report it as "saved to wiki". Never bare `rm` or `git rm` as a fleet delete (snapshot resurrects from S3). Never auto `npm install -g skillwiki` in headless/goal/satellite sessions. If `skillwiki page publish --help` is unavailable, fail closed.
60
-
61
- ## Sensitive Content
62
-
63
- Never commit secrets, credentials, API keys, tokens, passwords, or PII to the vault. Redact using `[REDACTED:<kind>]` before filing.
50
+ Never send secrets, credentials, tokens, passwords, or personal information.
51
+ Redact with `[REDACTED:<kind>]`.
64
52
 
65
53
  <!-- mcp-instructions:begin -->
66
54
  ## SkillWiki Remote Access Contract
67
55
 
68
56
  ### Three-Plane Access Architecture
69
- - **HTTP MCP (Default)**: Primary remote access plane for AI agents. All reads and mutations go through MCP tools; local vault clone is not required.
70
- - **CLI (Opt-in)**: Local operator and authoring plane for diagnostics, linting, and health checks on provisioned machines.
71
- - **Git Clone (Opt-in)**: Storage and sync authority on metal authoring hosts; leaf/agent environments do not manage git or push to remotes.
57
+ HTTP MCP is the default agent plane. CLI is an opt-in operator plane; Git clone
58
+ is storage authority on authoring hosts. Leaf agents do not manage vault git.
72
59
 
73
60
  ### Fail-Closed Boundary
74
- HTTP MCP is the sole agent writer. Never attempt direct local file writes to typed pages (concepts, entities, comparisons, queries, meta), index.md, or log.md. Direct filesystem mutations outside MCP fail closed. Always use MCP tools (wiki_capture, wiki_log_append, wiki_workitem_write, wiki_page_publish).
61
+ HTTP MCP is the sole managed writer. Use `wiki_capture`, `wiki_log_append`,
62
+ `wiki_workitem_write`, or `wiki_page_publish`; never write typed pages,
63
+ `index.md`, or `log.md` directly.
64
+
65
+ ### Vault Selection
66
+ For the usual vault, omit `vault` and use the live handshake's `default_vault`.
67
+ Set `vault` only when an extra vault was explicitly requested. Before reporting
68
+ a write as saved, check its successful receipt's `vault_id` against the intended
69
+ vault.
75
70
 
76
71
  ### CAS Protocol (Compare-And-Swap)
77
- Mutating tools (wiki_workitem_write, wiki_page_publish) enforce CAS concurrency control to prevent clobbering:
78
- 1. Call wiki_read_page to retrieve the document and its canonical sha256.
79
- 2. Submit mutations with base_sha256 set to the read sha256.
80
- 3. If the write returns FILE_CHANGED, re-read via wiki_read_page, rebase edits against currentVersion, and retry.
72
+ For `wiki_workitem_write` or `wiki_page_publish`, read first, send the returned
73
+ sha256 as `base_sha256`, and on `FILE_CHANGED` re-read, rebase, and retry.
81
74
 
82
75
  ### Capture Kinds
83
- Ad-hoc records via wiki_capture require kind in: task | idea | bug | note.
84
- Captures append remotely to raw/transcripts/ and never overwrite existing files. Use wiki_log_append for append-only log entries. Success returns a receipt; verify via wiki_read_page(event_path). Do not require reading log.md. wiki_read_page accepts optional tail_bytes for browsing oversized pages.
76
+ `wiki_capture` kind is `task | idea | bug | note`. Captures append to
77
+ `raw/transcripts/`. Verify its returned `path` with `wiki_read_page`.
78
+ `wiki_log_append` is append-only; verify its `event_path` with `wiki_read_page`.
79
+ Use `tail_bytes` for large pages.
85
80
 
86
81
  ### Sensitive Content
87
- Never send credentials, API keys, auth tokens, passwords, or PII. Redact sensitive values using [REDACTED:<kind>] (e.g. [REDACTED:token]) before writing.
82
+ Never send secrets or personal information. Use `[REDACTED:<kind>]`.
88
83
  <!-- mcp-instructions:end -->
89
84
 
90
- ## Drift Warning
91
-
92
- If `skillwiki doctor` mentions a version newer than this file, re-read the full `/using-skillwiki` skill for updated content.
93
-
94
- ## Canonical Paths
85
+ ## Drift and Canonical Paths
95
86
 
96
- - Full skill (logical): invoke `/using-skillwiki` or read the installed plugin skill at `<plugin-root>/using-skillwiki/SKILL.md` (repository source: `packages/skills/using-skillwiki/SKILL.md`)
97
- - Vault schema: `SCHEMA.md` at the vault root (run `skillwiki path` to resolve)
98
- - Frontier agents (`proj-work`, `proj-decide`): plugin-root `agents/<name>.md` with `model: inherit` — refresh with the active plugin channel (`grok plugin update skillwiki` on Grok)
87
+ If `skillwiki doctor` reports a newer version, invoke `using-skillwiki` again.
88
+ The full source skill is `packages/skills/using-skillwiki/SKILL.md`; resolve the
89
+ vault with `skillwiki path`. Frontier project agents are installed under the
90
+ plugin root with `model: inherit`.
@@ -14,7 +14,7 @@ SkillWiki captures are HTTP MCP only (`type: http`). Claude/Grok use `SKILLWIKI_
14
14
  ## First-run readiness
15
15
 
16
16
  - Resolve the installed plugin root from `GROK_PLUGIN_ROOT`, falling back to `CLAUDE_PLUGIN_ROOT`, and run `python3 "$PLUGIN_ROOT/scripts/check_readiness.py" --apply --json` before the first SkillWiki MCP call.
17
- - **Cursor / Grok Bot:** the Cursor-native plugin requires `SKILLWIKI_MCP_TOKEN` under **Plugins → Configure**. Optional non-secret `SKILLWIKI_EXTRA_VAULTS` (comma-separated vault ids such as `wiki-fin`) opts the client into extra vaults on the **same** connector URL. It is not a second connector, not a secret, and not written to `~/.cursor/mcp.json` or Grok `config.toml`. Server `allowed_vaults` remains the security boundary; an extra listed here but missing from the bearer still fails closed. Omit `vault=` on tools to use the handshake `default_vault` (central). Grok Bot does not inherit Mac process env or `~/.cursor/mcp.json`. `failed_to_load` with no token box means this package is missing; after this package is installed, Configure is the token field (same pattern as grok-search).
17
+ - **Cursor / Grok Bot:** the Cursor-native plugin requires `SKILLWIKI_MCP_TOKEN` under **Plugins → Configure**. Optional non-secret `SKILLWIKI_EXTRA_VAULTS` (comma-separated vault ids such as `wiki-fin`) opts the client into extra vaults on the **same** connector URL. It is not a second connector, not a secret, and not written to `~/.cursor/mcp.json` or Grok `config.toml`. Server `allowed_vaults` remains the security boundary; an extra listed here but missing from the bearer still fails closed. Omit `vault=` on tools to use the live handshake `default_vault`; specify an extra vault only when requested. Grok Bot does not inherit Mac process env or `~/.cursor/mcp.json`. `failed_to_load` with no token box means this package is missing; after this package is installed, Configure is the token field (same pattern as grok-search).
18
18
  - `missing_prereq` means `SKILLWIKI_MCP_TOKEN` is absent from process environment; stop and ask for a bearer. Do not invent a stdio MCP.
19
19
  - A new host (a machine that should write the wiki for the first time) needs an issued host-id bearer before handshake can pass. The operator runs `skillwiki mcp-auth issue-host --host-id <id> --write` on metal (TTY required). Connector hosts put the printed value into process env or host Configure. Unknown agents (no plugin / no usable connector) ingest a chat-attached env file with `skillwiki connect --from-file` (or `--from-stdin`); do not instruct paste-into-chat. Do not auto-write `mcp.env`, `mcp.json`, or Grok `config.toml`. Do not invent a second admin skill. A local vault/FUSE mirror is optional.
20
20
  - First-run order: install plugin/CLI → operator issues on metal → connector Configure **or** unknown-agent `skillwiki connect --from-file <attachment>` → **new session** → `skillwiki doctor --check-mcp` → one write (`wiki_capture`, work-item write, or page publish).
@@ -32,7 +32,9 @@ Remotes still on a pre-HTTP-MCP plugin or CLI must upgrade the plugin channel (a
32
32
 
33
33
  On leaf hosts, wiki captures go through MCP. Do **not** write `raw/transcripts/` or `log.md` as local files.
34
34
 
35
- 1. Call MCP `wiki_capture` with `kind` (`task` | `idea` | `bug` | `note`), `project`, `title`, and `content`. Optional `agent_note`.
35
+ Check the successful write receipt's `vault_id` against the intended vault before reporting any write as saved.
36
+
37
+ 1. Call MCP `wiki_capture` with `kind` (`task` | `idea` | `bug` | `note`), `project`, `title`, and `content`. Optional `agent_note`. Verify its returned `path` with `wiki_read_page` in that vault.
36
38
  2. Call MCP `wiki_log_append` when a structural `log.md` line is needed. Pass append-only `content` (optional `operation_id` is 64 hex). Success returns a receipt (`operation_id`, `event_path`, hashes, `s3_verified`). Verify the exact block via `wiki_read_page(event_path)`. Do not require reading `log.md`. If `log.md` is over 256 KiB, full `wiki_read_page("log.md")` returns `PAGE_TOO_LARGE`; use `tail_bytes` only to browse the newest end.
37
39
  3. **Feature-detect work-item and page-publish tools**:
38
40
  - When the server advertises `wiki_workitem_write`: use it to create, mutate, or close work items under `projects/<slug>/work/**` or update `projects/<slug>/knowledge.md`, and to save Layer-3 workspace markdown: `projects/<slug>/README.md`, `projects/<slug>/architecture/**/*.md`, `projects/<slug>/requirements/**/*.md`, `projects/<slug>/compound/**/*.md`. Pass `path`, `content`, and `base_sha256` of existing bytes (from `wiki_read_page` or local mirror). On `FILE_CHANGED`, re-read and retry once. Deployed servers that predate the workspace-family allowlist deny those paths — treat that `PATH_DENIED` as "server predates this release"; STOP, do not fall back.
@@ -1,98 +1,90 @@
1
1
  # SkillWiki Activation
2
2
 
3
- You have SkillWiki - a project-aware knowledge-base CLI + skill suite for agent harnesses.
4
- This file is loaded at session start. For full operational detail, invoke `/using-skillwiki`.
3
+ SkillWiki is the project-aware knowledge base and skill suite. This file is
4
+ session-start routing context; invoke `using-skillwiki` for full instructions.
5
5
 
6
- ## CLI Probe
6
+ ## Route
7
7
 
8
- If `skillwiki --help` fails, the CLI is unavailable. Degrade to manual file ops (grep/find) for read-only queries. Fail closed for managed mutations - never write typed pages, index, or log directly.
8
+ Use SkillWiki for vault or wiki work: setup, capture, ingestion, search, health,
9
+ provenance, lifecycle, project workspaces, decisions, sync, or graphing.
10
+ Choose the matching installed skill:
9
11
 
10
- ## When to Route
12
+ - Setup and input: `wiki-init`, `wiki-ingest`, `wiki-add-task`,
13
+ `wiki-adapter-prd`, `skillwiki-connect`.
14
+ - Read and maintain: `wiki-query`, `wiki-lint`, `wiki-audit`,
15
+ `wiki-crystallize`, `wiki-reingest`, `wiki-archive`, `wiki-remove`.
16
+ - Projects and planning: `proj-init`, `proj-work`, `proj-distill`,
17
+ `proj-decide`, `wiki-gate-plan-mode`, `dev-loop:research`.
18
+ - Fleet and visualization: `wiki-sync`, `wiki-canvas`.
19
+ - HTTP MCP capture or append: `skillwiki-mcp`.
11
20
 
12
- Invoke a SkillWiki skill when the user: wants vault/wiki/knowledge-base operations, ingests sources or URLs, searches/queries vault content, runs health checks or lint, crystallizes a session, works with project workspaces/ADRs, captures ideas/bugs/tasks, archives pages, removes paths, detects source drift, ingests foreign PRD formats, syncs vault git, or visualizes the vault graph.
21
+ If routing is unclear, invoke `using-skillwiki` rather than guessing.
13
22
 
14
- ## Skill Map
23
+ ## CLI and Planning
15
24
 
16
- | Skill | When to Invoke |
17
- |-------|----------------|
18
- | `wiki-init` | Bootstrap a vault |
19
- | `wiki-ingest` | Convert URLs/files/text into typed-knowledge pages |
20
- | `wiki-query` | Search typed knowledge |
21
- | `wiki-lint` | Vault health and lint checks |
22
- | `wiki-crystallize` | Distill current session into a typed page |
23
- | `wiki-audit` | Verify raw provenance and source integrity |
24
- | `wiki-archive` | Archive typed pages or preserve-move raw sources |
25
- | `wiki-remove` | Hard-delete vault paths without snapshot resurrection |
26
- | `wiki-reingest` | Detect source drift and re-ingest updated content |
27
- | `wiki-add-task` | Quick-capture ideas, bugs, tasks, notes (HTTP MCP on leaf hosts; local files on authoring hosts) |
28
- | `skillwiki-mcp` | HTTP MCP captures (`wiki_capture`, `wiki_log_append`); never local writes on leaf hosts |
29
- | `skillwiki-connect` | Unknown-agent HTTP MCP connect: `skillwiki connect --from-file` (never paste-into-chat) |
30
- | `wiki-adapter-prd` | Map foreign PRD formats (CodeStable, RFC, AIDE, Hermes) |
31
- | `wiki-sync` | Safely sync vault git repository |
32
- | `wiki-canvas` | Generate Obsidian Canvas visualization |
33
- | `wiki-gate-plan-mode` | Toggle EnterPlanMode gating for brainstorming then proj-work |
34
- | `proj-init` | Bootstrap a project workspace |
35
- | `proj-work` | Open or run a work item |
36
- | `proj-distill` | Distill project compound entries into concept pages |
37
- | `proj-decide` | Write an Architectural Decision Record (ADR) |
38
- | `dev-loop:research` | Research scan of repo + vault health |
25
+ If `skillwiki --help` fails, use local tools only for read-only inspection and
26
+ fail closed for managed mutations.
39
27
 
40
- ## PRD Bridge
28
+ After architectural design approval, invoke `proj-work` and put `spec.md` in
29
+ that work item. Do not invoke `writing-plans`. Do not git commit from
30
+ brainstorming. Use standalone `test-driven-development` for bounded TDD. For UI
31
+ work, offer `visual-companion.md` once. Never create `docs/superpowers/`.
41
32
 
42
- After architectural design approval, invoke `proj-work` then write `spec.md` in that work folder. Do not invoke `writing-plans`. Do not git commit from brainstorming. Bounded TDD uses standalone `test-driven-development` when installed. For UI work, offer brainstorming `visual-companion.md` once (optional). Never create `docs/superpowers/` in any repo.
33
+ Workflow profiles are `native`, `guided`, and explicit-only `full`; selection
34
+ is `adaptive` or `fixed`. Installation or cache discovery proves availability,
35
+ not activation. Native and guided do not force Superpowers or plan-mode gating.
36
+ Only a full profile may use its configured provider flow. Invalid fixed policy
37
+ fails closed; noninteractive sessions do not prompt. Keep workflow profile,
38
+ PRD provider and stage, SkillWiki provenance, and simplify review independent.
43
39
 
44
- ## Workflow Profiles
40
+ ## Managed-Write Safety
45
41
 
46
- Resolve workflow policy before loading provider skills. Profiles are `native`,
47
- `guided`, and explicit-only `full`; selection is `adaptive` or `fixed`.
48
- Adaptive chooses only native or guided. Installation and cache discovery prove
49
- availability, never activation. Native and guided do not force Superpowers or
50
- plan-mode gating. Explicit full may use the complete configured provider flow;
51
- gate plan mode only when that flow actually uses Superpowers/TDD planning.
52
- Invalid fixed policy is unresolved and fail-closed. Noninteractive sessions do
53
- not prompt. Keep workflow profile, `prd_layer` provider, `prd_pipeline` stage
54
- template, SkillWiki provenance, and the independent simplify review gate as
55
- separate concerns.
42
+ The HTTP MCP contract below controls remote reads and mutations. On leaf hosts,
43
+ captures use MCP, never local `raw/transcripts` or `log.md` writes. Project
44
+ workspace writes use `wiki_workitem_write` with compare-and-swap; stop if the
45
+ tool or path family is unavailable. A wiki push or rclone copy is not a managed
46
+ write and is not visible until the authoritative snapshot. Never use bare `rm`
47
+ or `git rm` for fleet deletion. Never auto-install SkillWiki in unattended
48
+ sessions. If required publish support is unavailable, fail closed.
56
49
 
57
- ## Fail-Closed Boundary
58
-
59
- Never write typed pages, `index.md`, or `log.md` directly. On leaf hosts, captures use HTTP MCP (`wiki_capture`), never local `raw/transcripts` or `log.md` writes. Project workspace saves (`projects/<slug>/README.md`, `architecture/`, `requirements/`, `compound/` — `.md` only) go through MCP `wiki_workitem_write` CAS; feature-detect and STOP if the tool is absent or the deployed server predates the workspace-family allowlist (`PATH_DENIED`). wiki-push / rclone is never an agent writer — an S3-only copy is invisible to `wiki_read_page` until the sg01 snapshot; never report it as "saved to wiki". Never bare `rm` or `git rm` as a fleet delete (snapshot resurrects from S3). Never auto `npm install -g skillwiki` in headless/goal/satellite sessions. If `skillwiki page publish --help` is unavailable, fail closed.
60
-
61
- ## Sensitive Content
62
-
63
- Never commit secrets, credentials, API keys, tokens, passwords, or PII to the vault. Redact using `[REDACTED:<kind>]` before filing.
50
+ Never send secrets, credentials, tokens, passwords, or personal information.
51
+ Redact with `[REDACTED:<kind>]`.
64
52
 
65
53
  <!-- mcp-instructions:begin -->
66
54
  ## SkillWiki Remote Access Contract
67
55
 
68
56
  ### Three-Plane Access Architecture
69
- - **HTTP MCP (Default)**: Primary remote access plane for AI agents. All reads and mutations go through MCP tools; local vault clone is not required.
70
- - **CLI (Opt-in)**: Local operator and authoring plane for diagnostics, linting, and health checks on provisioned machines.
71
- - **Git Clone (Opt-in)**: Storage and sync authority on metal authoring hosts; leaf/agent environments do not manage git or push to remotes.
57
+ HTTP MCP is the default agent plane. CLI is an opt-in operator plane; Git clone
58
+ is storage authority on authoring hosts. Leaf agents do not manage vault git.
72
59
 
73
60
  ### Fail-Closed Boundary
74
- HTTP MCP is the sole agent writer. Never attempt direct local file writes to typed pages (concepts, entities, comparisons, queries, meta), index.md, or log.md. Direct filesystem mutations outside MCP fail closed. Always use MCP tools (wiki_capture, wiki_log_append, wiki_workitem_write, wiki_page_publish).
61
+ HTTP MCP is the sole managed writer. Use `wiki_capture`, `wiki_log_append`,
62
+ `wiki_workitem_write`, or `wiki_page_publish`; never write typed pages,
63
+ `index.md`, or `log.md` directly.
64
+
65
+ ### Vault Selection
66
+ For the usual vault, omit `vault` and use the live handshake's `default_vault`.
67
+ Set `vault` only when an extra vault was explicitly requested. Before reporting
68
+ a write as saved, check its successful receipt's `vault_id` against the intended
69
+ vault.
75
70
 
76
71
  ### CAS Protocol (Compare-And-Swap)
77
- Mutating tools (wiki_workitem_write, wiki_page_publish) enforce CAS concurrency control to prevent clobbering:
78
- 1. Call wiki_read_page to retrieve the document and its canonical sha256.
79
- 2. Submit mutations with base_sha256 set to the read sha256.
80
- 3. If the write returns FILE_CHANGED, re-read via wiki_read_page, rebase edits against currentVersion, and retry.
72
+ For `wiki_workitem_write` or `wiki_page_publish`, read first, send the returned
73
+ sha256 as `base_sha256`, and on `FILE_CHANGED` re-read, rebase, and retry.
81
74
 
82
75
  ### Capture Kinds
83
- Ad-hoc records via wiki_capture require kind in: task | idea | bug | note.
84
- Captures append remotely to raw/transcripts/ and never overwrite existing files. Use wiki_log_append for append-only log entries. Success returns a receipt; verify via wiki_read_page(event_path). Do not require reading log.md. wiki_read_page accepts optional tail_bytes for browsing oversized pages.
76
+ `wiki_capture` kind is `task | idea | bug | note`. Captures append to
77
+ `raw/transcripts/`. Verify its returned `path` with `wiki_read_page`.
78
+ `wiki_log_append` is append-only; verify its `event_path` with `wiki_read_page`.
79
+ Use `tail_bytes` for large pages.
85
80
 
86
81
  ### Sensitive Content
87
- Never send credentials, API keys, auth tokens, passwords, or PII. Redact sensitive values using [REDACTED:<kind>] (e.g. [REDACTED:token]) before writing.
82
+ Never send secrets or personal information. Use `[REDACTED:<kind>]`.
88
83
  <!-- mcp-instructions:end -->
89
84
 
90
- ## Drift Warning
91
-
92
- If `skillwiki doctor` mentions a version newer than this file, re-read the full `/using-skillwiki` skill for updated content.
93
-
94
- ## Canonical Paths
85
+ ## Drift and Canonical Paths
95
86
 
96
- - Full skill (logical): invoke `/using-skillwiki` or read the installed plugin skill at `<plugin-root>/using-skillwiki/SKILL.md` (repository source: `packages/skills/using-skillwiki/SKILL.md`)
97
- - Vault schema: `SCHEMA.md` at the vault root (run `skillwiki path` to resolve)
98
- - Frontier agents (`proj-work`, `proj-decide`): plugin-root `agents/<name>.md` with `model: inherit` — refresh with the active plugin channel (`grok plugin update skillwiki` on Grok)
87
+ If `skillwiki doctor` reports a newer version, invoke `using-skillwiki` again.
88
+ The full source skill is `packages/skills/using-skillwiki/SKILL.md`; resolve the
89
+ vault with `skillwiki path`. Frontier project agents are installed under the
90
+ plugin root with `model: inherit`.