mdkg 0.1.1 → 0.1.3
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.
- package/CHANGELOG.md +104 -0
- package/README.md +124 -18
- package/dist/cli.js +567 -15
- package/dist/commands/archive.js +486 -0
- package/dist/commands/bundle.js +743 -0
- package/dist/commands/bundle_import.js +255 -0
- package/dist/commands/capability.js +162 -0
- package/dist/commands/checkpoint.js +31 -5
- package/dist/commands/doctor.js +269 -9
- package/dist/commands/format.js +38 -9
- package/dist/commands/index.js +12 -12
- package/dist/commands/init.js +194 -63
- package/dist/commands/init_manifest.js +19 -6
- package/dist/commands/list.js +5 -2
- package/dist/commands/new.js +36 -7
- package/dist/commands/next.js +7 -0
- package/dist/commands/node_card.js +4 -1
- package/dist/commands/pack.js +62 -2
- package/dist/commands/query_output.js +1 -0
- package/dist/commands/search.js +5 -2
- package/dist/commands/show.js +7 -14
- package/dist/commands/skill_mirror.js +22 -0
- package/dist/commands/task.js +23 -6
- package/dist/commands/upgrade.js +24 -1
- package/dist/commands/validate.js +20 -1
- package/dist/commands/work.js +397 -0
- package/dist/commands/workspace.js +12 -2
- package/dist/core/config.js +115 -1
- package/dist/graph/agent_file_types.js +78 -5
- package/dist/graph/archive_file.js +125 -0
- package/dist/graph/archive_integrity.js +66 -0
- package/dist/graph/bundle_imports.js +418 -0
- package/dist/graph/capabilities_index_cache.js +103 -0
- package/dist/graph/capabilities_indexer.js +231 -0
- package/dist/graph/frontmatter.js +19 -0
- package/dist/graph/index_cache.js +23 -6
- package/dist/graph/indexer.js +4 -1
- package/dist/graph/node.js +23 -4
- package/dist/graph/node_body.js +37 -0
- package/dist/graph/reindex.js +46 -0
- package/dist/graph/skills_index_cache.js +2 -2
- package/dist/graph/skills_indexer.js +8 -3
- package/dist/graph/sqlite_index.js +293 -0
- package/dist/graph/validate_graph.js +83 -7
- package/dist/graph/visibility.js +214 -0
- package/dist/graph/workspace_files.js +22 -0
- package/dist/init/AGENT_START.md +24 -0
- package/dist/init/CLI_COMMAND_MATRIX.md +61 -3
- package/dist/init/README.md +70 -4
- package/dist/init/config.json +18 -2
- package/dist/init/core/guide.md +6 -2
- package/dist/init/core/rule-1-mdkg-conventions.md +2 -1
- package/dist/init/core/rule-3-cli-contract.md +72 -4
- package/dist/init/core/rule-4-repo-safety-and-ignores.md +47 -11
- package/dist/init/core/rule-5-release-and-versioning.md +4 -3
- package/dist/init/core/rule-6-templates-and-schemas.md +7 -0
- package/dist/init/init-manifest.json +21 -16
- package/dist/init/skills/default/build-pack-and-execute-task/SKILL.md +2 -1
- package/dist/init/skills/default/verify-close-and-checkpoint/SKILL.md +26 -0
- package/dist/init/templates/default/archive.md +33 -0
- package/dist/init/templates/default/receipt.md +15 -1
- package/dist/init/templates/default/work.md +6 -1
- package/dist/init/templates/default/work_order.md +15 -1
- package/dist/pack/export_md.js +3 -0
- package/dist/pack/export_xml.js +3 -0
- package/dist/pack/order.js +1 -0
- package/dist/pack/pack.js +3 -13
- package/dist/util/argparse.js +30 -0
- package/dist/util/atomic.js +44 -0
- package/dist/util/lock.js +72 -0
- package/dist/util/refs.js +40 -0
- package/dist/util/zip.js +153 -0
- package/package.json +14 -5
|
@@ -26,6 +26,26 @@ function listMarkdownFiles(dir) {
|
|
|
26
26
|
}
|
|
27
27
|
return files;
|
|
28
28
|
}
|
|
29
|
+
function listArchiveSidecarFiles(dir) {
|
|
30
|
+
if (!fs_1.default.existsSync(dir)) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const entries = fs_1.default.readdirSync(dir, { withFileTypes: true });
|
|
34
|
+
const files = [];
|
|
35
|
+
for (const entry of entries) {
|
|
36
|
+
if (entry.name === "source") {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const fullPath = path_1.default.join(dir, entry.name);
|
|
40
|
+
if (entry.isDirectory()) {
|
|
41
|
+
files.push(...listArchiveSidecarFiles(fullPath));
|
|
42
|
+
}
|
|
43
|
+
else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
44
|
+
files.push(fullPath);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return files;
|
|
48
|
+
}
|
|
29
49
|
function getWorkspaceDocRoots(root, config) {
|
|
30
50
|
const roots = [];
|
|
31
51
|
const aliases = Object.keys(config.workspaces).sort();
|
|
@@ -46,6 +66,7 @@ function listWorkspaceDocFiles(root, config) {
|
|
|
46
66
|
const folderPath = path_1.default.join(wsRoot, folder);
|
|
47
67
|
files.push(...listMarkdownFiles(folderPath));
|
|
48
68
|
}
|
|
69
|
+
files.push(...listArchiveSidecarFiles(path_1.default.join(wsRoot, "archive")));
|
|
49
70
|
}
|
|
50
71
|
return files;
|
|
51
72
|
}
|
|
@@ -57,6 +78,7 @@ function listWorkspaceDocFilesByAlias(root, config) {
|
|
|
57
78
|
const folderPath = path_1.default.join(wsRoot, folder);
|
|
58
79
|
files.push(...listMarkdownFiles(folderPath));
|
|
59
80
|
}
|
|
81
|
+
files.push(...listArchiveSidecarFiles(path_1.default.join(wsRoot, "archive")));
|
|
60
82
|
files.sort();
|
|
61
83
|
result[alias] = files;
|
|
62
84
|
}
|
package/dist/init/AGENT_START.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This repository uses mdkg for deterministic project memory.
|
|
4
4
|
|
|
5
|
+
mdkg is pre-v1 public alpha software. Treat generated graph, cache, bundle, and DAL contracts as usable but still stabilizing before v1.
|
|
6
|
+
|
|
5
7
|
Read these files in order:
|
|
6
8
|
1. `.mdkg/core/SOUL.md` if it exists
|
|
7
9
|
2. `.mdkg/core/HUMAN.md` if it exists
|
|
@@ -22,6 +24,18 @@ Agent operating prompt:
|
|
|
22
24
|
- Use `mdkg show <id>` for direct inspection and `mdkg show <id> --meta` for card-only inspection.
|
|
23
25
|
- Use `mdkg search "..."` and `mdkg next` to discover current work.
|
|
24
26
|
- Use `mdkg skill list`, `mdkg skill search`, and `mdkg skill show <slug>` for skill discovery.
|
|
27
|
+
- Use `mdkg capability list/search/show` for deterministic skills, `SPEC.md`, `WORK.md`, core-doc, and design-doc capability discovery.
|
|
28
|
+
- Use `mdkg index` to refresh JSON compatibility caches and `.mdkg/index/mdkg.sqlite` when SQLite mode is enabled.
|
|
29
|
+
- Use `mdkg archive add/list/show/verify/compress` for committed source and artifact sidecars under `.mdkg/archive`.
|
|
30
|
+
- Use `mdkg work ...` helpers for semantic mirror contracts, work orders, receipts, and artifact registration.
|
|
31
|
+
- Treat work contracts, orders, and receipts as committed semantic mirrors only; never store raw secrets, credentials, live payment state, ledger mutations, or canonical marketplace state in mdkg.
|
|
32
|
+
- Use `artifact://...` for external/runtime-managed artifacts and `archive://...` for committed mdkg archive sidecars.
|
|
33
|
+
- Use `mdkg bundle create/list/show/verify` for explicit full `.mdkg` graph snapshot bundles.
|
|
34
|
+
- Use `mdkg bundle import add/list/verify` to register child bundle snapshots as read-only planning context.
|
|
35
|
+
- Use `mdkg pack <id> --visibility public|internal` only when you need a public-safe or internal-safe pack; no flag remains private-capable local behavior.
|
|
36
|
+
- Mark archive sidecars public only with explicit `mdkg archive add --visibility public` intent.
|
|
37
|
+
- Treat sidecar `.md` plus deterministic `.zip` caches as the commit-eligible archive record; validation and `mdkg archive verify` both check ZIP payload integrity.
|
|
38
|
+
- Before committing repos that track archive caches or `.mdkg/bundles/`, run `mdkg archive compress --all`, `mdkg archive verify --json`, `mdkg bundle create --profile private`, and `mdkg bundle verify .mdkg/bundles/private/all.mdkg.zip`.
|
|
25
39
|
- Use `mdkg task start/update/done` for structured task, bug, and test lifecycle fields.
|
|
26
40
|
- Use `mdkg upgrade` to preview scaffold updates; only run `mdkg upgrade --apply` after reviewing the receipt.
|
|
27
41
|
- Keep nuanced summaries, body text, and manual parent closeout edits in markdown.
|
|
@@ -42,12 +56,22 @@ If no task is known:
|
|
|
42
56
|
- `mdkg next`
|
|
43
57
|
- then use `mdkg pack <id>`
|
|
44
58
|
|
|
59
|
+
If this is a fresh import or external docs bundle:
|
|
60
|
+
- create a root epic, PRD, or EDD that captures the imported context and source locations
|
|
61
|
+
- create follow-on tasks and tests from that root context instead of scattering untracked notes
|
|
62
|
+
- run `mdkg validate` after the first ingestion pass
|
|
63
|
+
|
|
45
64
|
Skill discovery:
|
|
46
65
|
- `mdkg skill list --tags stage:plan --json`
|
|
47
66
|
- `mdkg skill list --tags stage:execute --json`
|
|
48
67
|
- `mdkg skill list --tags stage:review --json`
|
|
49
68
|
- `mdkg skill show select-work-and-ground-context`
|
|
50
69
|
|
|
70
|
+
Capability discovery:
|
|
71
|
+
- `mdkg capability list --kind skill --json`
|
|
72
|
+
- `mdkg capability search "<query>" --kind spec --json`
|
|
73
|
+
- `mdkg capability search "<query>" --kind work --json`
|
|
74
|
+
|
|
51
75
|
Conventions:
|
|
52
76
|
- `AGENTS.md` is the Codex/OpenAI-oriented wrapper doc.
|
|
53
77
|
- `CLAUDE.md` is the Claude-oriented wrapper doc.
|
|
@@ -15,9 +15,18 @@ Primary commands:
|
|
|
15
15
|
- `mdkg search`
|
|
16
16
|
- `mdkg pack`
|
|
17
17
|
- `mdkg skill`
|
|
18
|
+
- `mdkg capability`
|
|
19
|
+
- `mdkg archive`
|
|
20
|
+
- `mdkg bundle`
|
|
21
|
+
- `mdkg work`
|
|
18
22
|
- `mdkg task`
|
|
19
23
|
- `mdkg validate`
|
|
20
24
|
|
|
25
|
+
Index backend:
|
|
26
|
+
- fresh mdkg workspaces default to `index.backend: sqlite`
|
|
27
|
+
- `.mdkg/index/mdkg.sqlite` is rebuildable and commit-eligible when intentionally tracked
|
|
28
|
+
- JSON compatibility caches remain generated and ignored by default
|
|
29
|
+
|
|
21
30
|
Validation commands:
|
|
22
31
|
- `mdkg validate [--out <path>] [--quiet] [--json]`
|
|
23
32
|
|
|
@@ -42,7 +51,7 @@ Agent workflow notes:
|
|
|
42
51
|
|
|
43
52
|
Workspace registry commands:
|
|
44
53
|
- `mdkg workspace ls [--json]`
|
|
45
|
-
- `mdkg workspace add <alias> <path> [--mdkg-dir <dir>] [--json]`
|
|
54
|
+
- `mdkg workspace add <alias> <path> [--mdkg-dir <dir>] [--visibility <level>] [--json]`
|
|
46
55
|
- `mdkg workspace rm <alias> [--json]`
|
|
47
56
|
- `mdkg workspace enable <alias> [--json]`
|
|
48
57
|
- `mdkg workspace disable <alias> [--json]`
|
|
@@ -60,10 +69,10 @@ Checkpoint commands:
|
|
|
60
69
|
- `mdkg checkpoint new <title> [--ws <alias>] [--json]`
|
|
61
70
|
|
|
62
71
|
Agent bootstrap:
|
|
63
|
-
- `mdkg init --llm`
|
|
64
72
|
- `mdkg init --agent`
|
|
65
|
-
- `mdkg init --llm --agent`
|
|
66
73
|
- published bootstrap config is root-only by default
|
|
74
|
+
- `mdkg init --agent` creates the complete startup docs, wrapper docs, default mdkg skills, event log, registry, and skill mirrors
|
|
75
|
+
- removed flags `--llm`, `--agents`, `--claude`, and `--omni` fail before mutation with guidance to use `mdkg init --agent`
|
|
67
76
|
|
|
68
77
|
Upgrade:
|
|
69
78
|
- `mdkg upgrade` previews safe scaffold updates and writes nothing by default
|
|
@@ -79,6 +88,55 @@ Skill discovery:
|
|
|
79
88
|
- `mdkg skill validate [<slug>] [--json]`
|
|
80
89
|
- `mdkg skill sync [--force] [--json]`
|
|
81
90
|
|
|
91
|
+
Capability discovery:
|
|
92
|
+
- `mdkg capability list [--kind <skill|spec|work|core|design>] [--visibility <private|internal|public>] [--json]`
|
|
93
|
+
- `mdkg capability search "<query>" [--kind <kind>] [--visibility <level>] [--json]`
|
|
94
|
+
- `mdkg capability show <id-or-qid-or-slug> [--json]`
|
|
95
|
+
- capability records are deterministic cache projections from Markdown
|
|
96
|
+
- records include source hash, headings, refs, and `indexed_at`
|
|
97
|
+
- normal task, epic, feat, bug, test, and checkpoint nodes are intentionally excluded
|
|
98
|
+
|
|
99
|
+
Archive sidecars:
|
|
100
|
+
- `mdkg archive add <file> [--id <archive.id>] [--kind source|artifact] [--visibility private|internal|public] [--title <title>] [--refs <...>] [--relates <...>] [--json]`
|
|
101
|
+
- `mdkg archive list [--kind source|artifact] [--visibility private|internal|public] [--ws <alias>] [--json]`
|
|
102
|
+
- `mdkg archive show <id-or-archive-uri> [--ws <alias>] [--json]`
|
|
103
|
+
- `mdkg archive verify [id-or-archive-uri] [--ws <alias>] [--json]`
|
|
104
|
+
- `mdkg archive compress <id-or-archive-uri|--all> [--json]`
|
|
105
|
+
- archive sidecars are `type: archive` nodes under `.mdkg/archive`
|
|
106
|
+
- archive visibility defaults to `private`
|
|
107
|
+
- `mdkg validate` and `mdkg archive verify` both check ZIP hash, ZIP readability, payload SHA-256, and payload byte size
|
|
108
|
+
- outside-repo archive sources are recorded as `external:<basename>` instead of absolute local paths
|
|
109
|
+
- `mdkg doctor` warns about ZIP caches larger than `archive.large_cache_warning_bytes`; `0` disables the warning
|
|
110
|
+
- committed sidecar `.md` files and ZIP caches are source-of-truth evidence; raw source copies under `.mdkg/archive/**/source/` are ignored by default
|
|
111
|
+
|
|
112
|
+
Graph snapshot bundles:
|
|
113
|
+
- `mdkg bundle create [--profile private|public] [--ws <alias|all>] [--output <path>] [--json]`
|
|
114
|
+
- `mdkg bundle verify [bundle-path] [--json]`
|
|
115
|
+
- `mdkg bundle show <bundle-path> [--json]`
|
|
116
|
+
- `mdkg bundle list [--json]`
|
|
117
|
+
- `mdkg bundle import add/list/rm/enable/disable/verify ...`
|
|
118
|
+
- `mdkg bundle import add <alias> <bundle-path> [--visibility private|internal|public] [--profile private|public] [--source-path <path>] [--json]`
|
|
119
|
+
- `mdkg bundle import verify [alias|--all] [--json]`
|
|
120
|
+
- default output is `.mdkg/bundles/<profile>/<workspace-or-all>.mdkg.zip`
|
|
121
|
+
- private bundles are explicit local graph transport artifacts
|
|
122
|
+
- bundle imports are read-only planning views and use import-alias qids such as `child_repo:task-1`
|
|
123
|
+
- repos that track archive caches or bundles should run `mdkg archive compress --all`, `mdkg archive verify --json`, `mdkg bundle create --profile private`, and `mdkg bundle verify .mdkg/bundles/private/all.mdkg.zip` before commit
|
|
124
|
+
- public bundles include only public workspace content and public archive sidecars
|
|
125
|
+
- public bundle creation fails when public records reference private graph, archive, or imported records
|
|
126
|
+
- public/internal imports require public bundle profiles
|
|
127
|
+
|
|
128
|
+
Work semantic mirrors:
|
|
129
|
+
- `mdkg work contract new "<title>" --id <work.id> --agent-id <agent.id> --kind <kind> --inputs <...> --outputs <...> [--required-capabilities <...>] [--pricing-model <...>] [--json]`
|
|
130
|
+
- `mdkg work order new "<title>" --id <order.id> --work-id <work.id> --requester <ref> [--request-ref <ref>] [--input-refs <...>] [--requested-outputs <...>] [--json]`
|
|
131
|
+
- `mdkg work order update <id-or-qid> [--status <status>] [--add-input-refs <...>] [--add-artifacts <...>] [--json]`
|
|
132
|
+
- `mdkg work receipt new "<title>" --id <receipt.id> --work-order-id <order.id> --outcome success|partial|failure [--receipt-status recorded|verified|rejected|superseded] [--json]`
|
|
133
|
+
- `mdkg work receipt update <id-or-qid> [--receipt-status <status>] [--add-artifacts <...>] [--add-proof-refs <...>] [--add-attestation-refs <...>] [--json]`
|
|
134
|
+
- `mdkg work artifact add <order-or-receipt-id-or-qid> <file> [--id <archive.id>] [--kind source|artifact] [--json]`
|
|
135
|
+
- work commands mutate mdkg semantic mirror files only; production order, receipt, feedback, dispute, payment, ledger, marketplace inventory, fulfillment, and execution state remains canonical outside mdkg
|
|
136
|
+
- do not store raw secrets, credentials, live payment state, ledger mutations, or canonical marketplace state in work mirrors
|
|
137
|
+
- `artifact://...` refs identify external/runtime-managed artifacts; `archive://...` refs identify committed mdkg archive sidecars
|
|
138
|
+
- work update and artifact commands accept local ids or local qids; imported bundle qids are read-only and must be changed in their source workspace
|
|
139
|
+
|
|
82
140
|
Discovery/show export flags:
|
|
83
141
|
- `--json`
|
|
84
142
|
- `--xml`
|
package/dist/init/README.md
CHANGED
|
@@ -2,26 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
This repository is initialized for mdkg.
|
|
4
4
|
|
|
5
|
+
mdkg is pre-v1 public alpha software. Graph, cache, bundle, and DAL contracts may change quickly before v1.
|
|
6
|
+
|
|
5
7
|
## Layout
|
|
6
8
|
|
|
7
9
|
- `core/`: rules, operating guide, and pinned docs
|
|
8
10
|
- `design/`: product/engineering decision records
|
|
9
11
|
- `work/`: epics, tasks, bugs, tests, checkpoints
|
|
10
12
|
- `templates/`: default node templates
|
|
11
|
-
- `
|
|
13
|
+
- `archive/`: sidecar metadata and deterministic compressed source/artifact caches
|
|
14
|
+
- `bundles/`: optional committed full graph snapshot bundles
|
|
15
|
+
- `index/`: generated JSON caches plus optional commit-eligible `mdkg.sqlite`
|
|
12
16
|
- `pack/`: generated context packs (do not commit)
|
|
13
17
|
|
|
14
|
-
##
|
|
18
|
+
## Next Commands
|
|
15
19
|
|
|
16
20
|
```bash
|
|
17
|
-
mdkg init --llm --agent
|
|
18
21
|
mdkg upgrade
|
|
22
|
+
mdkg new task "..." --status todo --priority 1
|
|
19
23
|
mdkg search "..."
|
|
20
24
|
mdkg show <id>
|
|
21
25
|
mdkg pack <id>
|
|
26
|
+
mdkg capability search "..."
|
|
27
|
+
mdkg archive list
|
|
28
|
+
mdkg bundle create --profile private
|
|
29
|
+
mdkg bundle import list --json
|
|
22
30
|
mdkg validate
|
|
23
31
|
```
|
|
24
32
|
|
|
33
|
+
This repo is already initialized. Use `mdkg upgrade` to preview safe scaffold updates, `mdkg new` to create work, `mdkg search`/`mdkg show` to inspect graph state, `mdkg capability ...` to inspect cached skill/spec/work/core/design capabilities, `mdkg archive ...` to register source/artifact sidecars, `mdkg work ...` to create work contract/order/receipt semantic mirrors, `mdkg bundle ...` to create full graph snapshot bundles and read-only child graph imports, `mdkg pack <id>` to build deterministic context, and `mdkg validate` before closeout.
|
|
34
|
+
|
|
25
35
|
Agent workflow docs can use semantic ids:
|
|
26
36
|
|
|
27
37
|
```bash
|
|
@@ -43,8 +53,16 @@ Read `AGENT_START.md` first when this repo includes it.
|
|
|
43
53
|
|
|
44
54
|
Ensure ignore files include:
|
|
45
55
|
|
|
46
|
-
- `.mdkg/index
|
|
56
|
+
- `.mdkg/index/*.json`
|
|
57
|
+
- `.mdkg/index/*.tmp`
|
|
58
|
+
- `.mdkg/index/write.lock/`
|
|
59
|
+
- `.mdkg/index/*.sqlite-wal`
|
|
60
|
+
- `.mdkg/index/*.sqlite-shm`
|
|
61
|
+
- `.mdkg/index/*.sqlite-journal`
|
|
47
62
|
- `.mdkg/pack/`
|
|
63
|
+
- `.mdkg/archive/**/source/`
|
|
64
|
+
|
|
65
|
+
Fresh mdkg workspaces default to `index.backend: sqlite`; `.mdkg/index/mdkg.sqlite` is a rebuildable cache and may be committed when the repo intentionally tracks it and it stays reasonably small.
|
|
48
66
|
|
|
49
67
|
Recommended:
|
|
50
68
|
|
|
@@ -57,3 +75,51 @@ mdkg init --update-gitignore --update-npmignore
|
|
|
57
75
|
`mdkg upgrade` previews safe scaffold updates for existing workspaces and writes nothing by default.
|
|
58
76
|
|
|
59
77
|
Use `mdkg upgrade --apply` only after reviewing `safe_to_apply`, `will_write_paths`, and `apply_side_effects` in the receipt. Local customizations are preserved and reported instead of overwritten. Missing built-in templates can be loaded from the installed package as a read-only fallback until you vendor them with upgrade.
|
|
78
|
+
|
|
79
|
+
## Snapshot Bundles
|
|
80
|
+
|
|
81
|
+
Create explicit full `.mdkg` graph snapshots with:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
mdkg archive compress --all
|
|
85
|
+
mdkg archive verify --json
|
|
86
|
+
mdkg bundle create --profile private
|
|
87
|
+
mdkg bundle verify .mdkg/bundles/private/all.mdkg.zip
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Use this as a pre-commit recommendation only when the repo tracks archive caches or `.mdkg/bundles/`. Private bundles are local graph transport artifacts and may be tracked in private repos when configured. Public bundles require selected workspaces with `visibility: public` and fail closed when public records reference private graph, archive, or imported records.
|
|
91
|
+
|
|
92
|
+
Register child bundle snapshots as read-only imports with:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
mdkg bundle import add child_repo child-repo/.mdkg/bundles/private/all.mdkg.zip --source-path child-repo
|
|
96
|
+
mdkg bundle import verify child_repo --json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Imported nodes use the import alias as their qid prefix and can be inspected or packed, but mutations must happen in the owning child repo.
|
|
100
|
+
|
|
101
|
+
## Archive and Work Mirrors
|
|
102
|
+
|
|
103
|
+
Archive source/artifact files with:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
mdkg archive add <file> --id archive.example --kind source --visibility private
|
|
107
|
+
mdkg archive verify archive://archive.example
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`mdkg validate` and `mdkg archive verify` both check the archive sidecar contract and deterministic ZIP payload integrity. Raw local archive source copies under `.mdkg/archive/**/source/` are ignored by default; sidecar `.md` files and ZIP caches are the commit-eligible evidence. Outside-repo sources are recorded as `external:<basename>`, and `mdkg doctor` warns about large ZIP caches using `archive.large_cache_warning_bytes` from `.mdkg/config.json`.
|
|
111
|
+
|
|
112
|
+
Use work lifecycle helpers for semantic mirrors only:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
mdkg work contract new "example capability" --id work.example --agent-id agent.example --kind example --inputs prompt:text:required --outputs result:text:required
|
|
116
|
+
mdkg work order new "example request" --id order.example-1 --work-id work.example --requester user://example
|
|
117
|
+
mdkg work receipt new "example receipt" --id receipt.example-1 --work-order-id order.example-1 --outcome success
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Receipt statuses are `recorded`, `verified`, `rejected`, and `superseded`.
|
|
121
|
+
Update and artifact commands accept local ids or local qids; imported bundle qids are read-only and must be changed in their source workspace.
|
|
122
|
+
|
|
123
|
+
Production orders, receipts, feedback, disputes, payments, ledgers, marketplace inventory, fulfillment records, and execution state remain canonical outside mdkg. mdkg stores committed semantic mirrors and reviewable evidence. Do not store raw secrets, credentials, live payment state, ledger mutations, canonical marketplace state, or bulky raw payloads in these mirrors.
|
|
124
|
+
|
|
125
|
+
Use `artifact://...` for external or runtime-managed artifact identities. Use `archive://...` only for committed mdkg archive sidecars.
|
package/dist/init/config.json
CHANGED
|
@@ -2,11 +2,26 @@
|
|
|
2
2
|
"schema_version": 1,
|
|
3
3
|
"tool": "mdkg",
|
|
4
4
|
"root_required": true,
|
|
5
|
+
"archive": {
|
|
6
|
+
"large_cache_warning_bytes": 26214400
|
|
7
|
+
},
|
|
5
8
|
"index": {
|
|
6
9
|
"auto_reindex": true,
|
|
7
10
|
"tolerant": false,
|
|
8
|
-
"
|
|
11
|
+
"backend": "sqlite",
|
|
12
|
+
"global_index_path": ".mdkg/index/global.json",
|
|
13
|
+
"sqlite_path": ".mdkg/index/mdkg.sqlite",
|
|
14
|
+
"sqlite_commit_warning_bytes": 52428800,
|
|
15
|
+
"lock_timeout_ms": 10000
|
|
16
|
+
},
|
|
17
|
+
"capabilities": {
|
|
18
|
+
"cache_path": ".mdkg/index/capabilities.json"
|
|
19
|
+
},
|
|
20
|
+
"bundles": {
|
|
21
|
+
"output_dir": ".mdkg/bundles",
|
|
22
|
+
"default_profile": "private"
|
|
9
23
|
},
|
|
24
|
+
"bundle_imports": {},
|
|
10
25
|
"pack": {
|
|
11
26
|
"default_depth": 2,
|
|
12
27
|
"default_edges": [
|
|
@@ -51,7 +66,8 @@
|
|
|
51
66
|
"root": {
|
|
52
67
|
"path": ".",
|
|
53
68
|
"enabled": true,
|
|
54
|
-
"mdkg_dir": ".mdkg"
|
|
69
|
+
"mdkg_dir": ".mdkg",
|
|
70
|
+
"visibility": "private"
|
|
55
71
|
}
|
|
56
72
|
}
|
|
57
73
|
}
|
package/dist/init/core/guide.md
CHANGED
|
@@ -10,7 +10,7 @@ relates: []
|
|
|
10
10
|
refs: []
|
|
11
11
|
aliases: []
|
|
12
12
|
created: 2026-01-06
|
|
13
|
-
updated: 2026-
|
|
13
|
+
updated: 2026-05-14
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
# Agent guide
|
|
@@ -19,8 +19,9 @@ This repo uses **mdkg** to manage documentation, decisions, and work tracking.
|
|
|
19
19
|
|
|
20
20
|
## Quickstart
|
|
21
21
|
|
|
22
|
-
- `mdkg init --
|
|
22
|
+
- `mdkg init --agent`
|
|
23
23
|
- `mdkg index`
|
|
24
|
+
- `mdkg capability list --kind skill --json`
|
|
24
25
|
- `mdkg new task "..." --status todo --priority 1`
|
|
25
26
|
- `mdkg list --status todo`
|
|
26
27
|
- `mdkg pack <id> --verbose`
|
|
@@ -32,6 +33,7 @@ This repo uses **mdkg** to manage documentation, decisions, and work tracking.
|
|
|
32
33
|
- `mdkg guide` (print this guide)
|
|
33
34
|
- `mdkg new <type> "<title>"`
|
|
34
35
|
- `mdkg list` / `mdkg show` / `mdkg search`
|
|
36
|
+
- `mdkg capability list` / `mdkg capability search` / `mdkg capability show`
|
|
35
37
|
- `mdkg pack`
|
|
36
38
|
- `mdkg next`
|
|
37
39
|
- `mdkg validate` / `mdkg format`
|
|
@@ -94,6 +96,8 @@ If formatting drift is common (especially with agent edits):
|
|
|
94
96
|
|
|
95
97
|
Index is cached by default and auto-reindexed when stale.
|
|
96
98
|
|
|
99
|
+
`mdkg index` writes the node index, skills index, and capability cache. The capability cache is a derived access layer for skills, `SPEC.md`, `WORK.md`, core docs, and design docs; it is not source of truth and does not include normal task/epic/test/checkpoint nodes.
|
|
100
|
+
|
|
97
101
|
If debugging index issues:
|
|
98
102
|
- run `mdkg index`
|
|
99
103
|
- inspect errors from strict frontmatter enforcement
|
|
@@ -229,8 +229,9 @@ The cache is enabled by default.
|
|
|
229
229
|
|
|
230
230
|
- Root global index lives at `.mdkg/index/global.json`
|
|
231
231
|
- Root skills index lives at `.mdkg/index/skills.json`
|
|
232
|
+
- Root SQLite access cache lives at `.mdkg/index/mdkg.sqlite` when `index.backend` is `sqlite`.
|
|
232
233
|
- Index is rebuilt automatically when stale unless disabled by flag/config.
|
|
233
|
-
- `.mdkg/index
|
|
234
|
+
- Generated JSON index/temp/lock files are ignored. `.mdkg/index/mdkg.sqlite` is rebuildable and may be committed only by explicit repo policy.
|
|
234
235
|
|
|
235
236
|
## Safety guidance (high level)
|
|
236
237
|
|
|
@@ -10,7 +10,7 @@ relates: []
|
|
|
10
10
|
refs: []
|
|
11
11
|
aliases: []
|
|
12
12
|
created: 2026-01-06
|
|
13
|
-
updated: 2026-
|
|
13
|
+
updated: 2026-05-17
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
# mdkg CLI contract
|
|
@@ -69,6 +69,9 @@ Workspaces are registered in `.mdkg/config.json`.
|
|
|
69
69
|
|
|
70
70
|
Qualified IDs may be used as input:
|
|
71
71
|
- `<ws>:<id>` (example: `e2e:task-12`)
|
|
72
|
+
- Imported bundle nodes use the same qualified form with the import alias:
|
|
73
|
+
- `<import-alias>:<id>` (example: `agent_image:work.generate-image`)
|
|
74
|
+
- imported nodes are read-only planning context and MUST NOT be selected by local mutation commands
|
|
72
75
|
|
|
73
76
|
If a user provides an unqualified ID and it is ambiguous globally:
|
|
74
77
|
- mdkg MUST error and suggest qualified IDs.
|
|
@@ -102,9 +105,14 @@ If a user provides an unqualified ID and it is ambiguous globally:
|
|
|
102
105
|
- updates `.gitignore` and `.npmignore` by default
|
|
103
106
|
- `--no-update-ignores` disables default ignore writes
|
|
104
107
|
- explicit flags (`--update-gitignore`, `--update-npmignore`, `--update-dockerignore`) force writes even with global opt-out
|
|
105
|
-
- `--
|
|
106
|
-
- `--agents
|
|
107
|
-
- `--agent` adds strict-node bootstrap docs and scaffolding:
|
|
108
|
+
- `--agent` is the canonical documented path for complete AI-agent bootstrap
|
|
109
|
+
- `--llm`, `--agents`, `--claude`, and `--omni` fail before mutation with guidance to use `mdkg init --agent`
|
|
110
|
+
- `--agent` adds startup docs, strict-node bootstrap docs, and scaffolding:
|
|
111
|
+
- `AGENT_START.md`
|
|
112
|
+
- `AGENTS.md`
|
|
113
|
+
- `CLAUDE.md`
|
|
114
|
+
- `llms.txt`
|
|
115
|
+
- `CLI_COMMAND_MATRIX.md`
|
|
108
116
|
- `.mdkg/core/SOUL.md` (`id: rule-soul`)
|
|
109
117
|
- `.mdkg/core/HUMAN.md` (`id: rule-human`)
|
|
110
118
|
- seeded canonical skills:
|
|
@@ -116,6 +124,7 @@ If a user provides an unqualified ID and it is ambiguous globally:
|
|
|
116
124
|
- `.agents/skills/`
|
|
117
125
|
- `.claude/skills/`
|
|
118
126
|
- deterministic `core.md` pin insertion (`rule-soul`, then `rule-human`)
|
|
127
|
+
- ignore policy for generated JSON index/temp/lock files, `.mdkg/pack/`, and raw archive source copies under `.mdkg/archive/**/source/`
|
|
119
128
|
- mirrored skills are append-focused outputs:
|
|
120
129
|
- `.mdkg/skills/` remains canonical
|
|
121
130
|
- unrelated existing folders under `.agents/skills/` and `.claude/skills/` are preserved
|
|
@@ -129,11 +138,15 @@ If a user provides an unqualified ID and it is ambiguous globally:
|
|
|
129
138
|
- `mdkg workspace ls`
|
|
130
139
|
- `mdkg workspace add <alias> <path>`
|
|
131
140
|
- `mdkg workspace rm <alias>`
|
|
141
|
+
- workspace entries may include advisory `visibility: private|internal|public` metadata for capability-cache filtering
|
|
132
142
|
|
|
133
143
|
### Indexing
|
|
134
144
|
- `mdkg index`
|
|
135
145
|
- rebuild global cache `.mdkg/index/global.json`
|
|
136
146
|
- rebuild skills cache `.mdkg/index/skills.json` from `.mdkg/skills/<slug>/SKILL.md`
|
|
147
|
+
- rebuild capability cache `.mdkg/index/capabilities.json` from skills, `SPEC.md`, `WORK.md`, core docs, and design docs
|
|
148
|
+
- rebuild bundle import projection cache `.mdkg/index/imports.json` when bundle imports are configured
|
|
149
|
+
- rebuild SQLite access cache `.mdkg/index/mdkg.sqlite` when `index.backend` is `sqlite`
|
|
137
150
|
- tolerate `.mdkg/skills/<slug>/SKILLS.md` on read with warning
|
|
138
151
|
- fail validation if both `SKILL.md` and `SKILLS.md` exist in one skill directory
|
|
139
152
|
- strict by default (fails on invalid frontmatter)
|
|
@@ -170,12 +183,64 @@ Common flags:
|
|
|
170
183
|
- `mdkg search "<query>" [--type <type>] [--status <status>] [--ws <alias>] [--tags <tag,tag,...>] [--tags-mode any|all] [--json|--xml|--toon|--md]`
|
|
171
184
|
- search SHOULD match on IDs, titles, tags, path tokens, and searchable frontmatter lists (`links`, `artifacts`, `refs`, `aliases`)
|
|
172
185
|
- `mdkg list [--type <type>] [--status <status>] [--ws <alias>] [--epic <id>] [--blocked] [--priority <n>] [--tags <tag,tag,...>] [--tags-mode any|all] [--json|--xml|--toon|--md]`
|
|
186
|
+
- enabled bundle imports are included in `show`, `search`, `list`, `pack`, and `capability` reads by default:
|
|
187
|
+
- imported nodes surface `source.imported: true` in JSON output
|
|
188
|
+
- human output labels imported nodes as read-only and stale when applicable
|
|
189
|
+
- stale imports warn during planning reads but remain usable
|
|
173
190
|
- skills are first-class under `mdkg skill ...` only:
|
|
174
191
|
- `mdkg skill list [--tags <tag,tag,...>] [--tags-mode any|all] [--json|--xml|--toon|--md]`
|
|
175
192
|
- `mdkg skill show <slug> [--meta] [--json|--xml|--toon|--md]`
|
|
176
193
|
- `mdkg skill search "<query>" [--tags <tag,tag,...>] [--tags-mode any|all] [--json|--xml|--toon|--md]`
|
|
177
194
|
- `mdkg skill validate [<slug>]`
|
|
178
195
|
- `mdkg skill sync [--force]`
|
|
196
|
+
- capabilities are cached Markdown projections under `mdkg capability ...`:
|
|
197
|
+
- `mdkg capability list [--kind <skill|spec|work|core|design>] [--visibility <private|internal|public>] [--json]`
|
|
198
|
+
- `mdkg capability search "<query>" [--kind <kind>] [--visibility <level>] [--json]`
|
|
199
|
+
- `mdkg capability show <id-or-qid-or-slug> [--json]`
|
|
200
|
+
- capability records are read-only derived cache entries, not source of truth
|
|
201
|
+
- normal task, epic, feat, bug, test, and checkpoint nodes are not capability records
|
|
202
|
+
- archives are first-class sidecar nodes under `mdkg archive ...`:
|
|
203
|
+
- `mdkg archive add <file> [--id <archive.id>] [--kind source|artifact] [--visibility private|internal|public] [--title <title>] [--refs <...>] [--relates <...>] [--json]`
|
|
204
|
+
- `mdkg archive list [--kind source|artifact] [--visibility private|internal|public] [--ws <alias>] [--json]`
|
|
205
|
+
- `mdkg archive show <id-or-archive-uri> [--ws <alias>] [--json]`
|
|
206
|
+
- `mdkg archive verify [id-or-archive-uri] [--ws <alias>] [--json]`
|
|
207
|
+
- `mdkg archive compress <id-or-archive-uri|--all> [--json]`
|
|
208
|
+
- `archive://<archive.id>` refs resolve against local archive sidecars
|
|
209
|
+
- archive visibility defaults to `private`
|
|
210
|
+
- in-repo source paths are recorded repo-relative; outside-repo source paths are redacted as `external:<basename>`
|
|
211
|
+
- `mdkg validate` and `mdkg archive verify` both check ZIP cache hash, ZIP readability, payload hash, and payload byte size
|
|
212
|
+
- raw copied sources live under `.mdkg/archive/**/source/`; sidecar `.md` and deterministic `.zip` caches remain commit-eligible
|
|
213
|
+
- full graph snapshot bundles live under `mdkg bundle ...`:
|
|
214
|
+
- `mdkg bundle create [--profile private|public] [--ws <alias|all>] [--output <path>] [--json]`
|
|
215
|
+
- `mdkg bundle verify [bundle-path] [--json]`
|
|
216
|
+
- `mdkg bundle show <bundle-path> [--json]`
|
|
217
|
+
- `mdkg bundle list [--json]`
|
|
218
|
+
- `mdkg bundle import add <alias> <bundle-path> [--visibility private|internal|public] [--profile private|public] [--source-path <path>] [--source-repo <ref>] [--max-stale-seconds <seconds>] [--json]`
|
|
219
|
+
- `mdkg bundle import list [--json]`
|
|
220
|
+
- `mdkg bundle import rm <alias> [--json]`
|
|
221
|
+
- `mdkg bundle import enable <alias> [--json]`
|
|
222
|
+
- `mdkg bundle import disable <alias> [--json]`
|
|
223
|
+
- `mdkg bundle import verify [alias|--all] [--json]`
|
|
224
|
+
- bundles are explicit transport artifacts and are not rewritten by `mdkg index`
|
|
225
|
+
- default output is `.mdkg/bundles/<profile>/<workspace-or-all>.mdkg.zip`
|
|
226
|
+
- public bundles must fail closed when public records reference private graph or archive records
|
|
227
|
+
- public bundles must fail closed when public records reference private/internal imported graph records
|
|
228
|
+
- bundle imports are read-only projected graph views; child repos remain owners of real mutations and commits
|
|
229
|
+
- `bundle import verify` exits nonzero for stale, missing, corrupt, profile-mismatched, or duplicate-id imports
|
|
230
|
+
- public bundle creation must not re-export imported child graph content and must fail if public local nodes reference private/internal imports
|
|
231
|
+
- public/internal imports require `expected_profile: public`; private bundle profiles cannot be promoted through import visibility
|
|
232
|
+
- `mdkg pack --visibility public|internal|private` records explicit pack visibility and filters public/internal packs through the same fail-closed policy
|
|
233
|
+
- work lifecycle helpers live under `mdkg work ...`:
|
|
234
|
+
- `mdkg work contract new "<title>" --id <work.id> --agent-id <agent.id> --kind <kind> --inputs <...> --outputs <...> [--required-capabilities <...>] [--pricing-model <...>] [--json]`
|
|
235
|
+
- `mdkg work order new "<title>" --id <order.id> --work-id <work.id> --requester <ref> [--request-ref <ref>] [--input-refs <...>] [--requested-outputs <...>] [--json]`
|
|
236
|
+
- `mdkg work order update <id-or-qid> [--status <status>] [--add-input-refs <...>] [--add-artifacts <...>] [--json]`
|
|
237
|
+
- `mdkg work receipt new "<title>" --id <receipt.id> --work-order-id <order.id> --outcome success|partial|failure [--receipt-status recorded|verified|rejected|superseded] [--json]`
|
|
238
|
+
- `mdkg work receipt update <id-or-qid> [--receipt-status <status>] [--add-artifacts <...>] [--add-proof-refs <...>] [--add-attestation-refs <...>] [--json]`
|
|
239
|
+
- `mdkg work artifact add <order-or-receipt-id-or-qid> <file> [--id <archive.id>] [--kind source|artifact] [--json]`
|
|
240
|
+
- these commands mutate mdkg semantic mirror files only; production order, receipt, feedback, dispute, payment, ledger, marketplace inventory, fulfillment, and execution state remains canonical outside mdkg
|
|
241
|
+
- work mirrors must not store raw secrets, credentials, live payment state, ledger mutations, or canonical marketplace state
|
|
242
|
+
- `artifact://...` refs identify external/runtime-managed artifacts; `archive://...` refs identify committed mdkg archive sidecars
|
|
243
|
+
- update and artifact commands accept local ids or local qids; imported bundle qids are read-only and must be changed in their source workspace
|
|
179
244
|
- discovery/show output flags are mutually exclusive; text mode remains the default when none are supplied
|
|
180
245
|
|
|
181
246
|
### Task lifecycle mutation
|
|
@@ -186,6 +251,7 @@ Common flags:
|
|
|
186
251
|
- supports additive list mutation for `artifacts`, `links`, `refs`, `skills`, `tags`, and `blocked_by`
|
|
187
252
|
- supports scalar replacement for `status` and `priority`
|
|
188
253
|
- `--clear-blocked-by` resets blockers before optional re-add
|
|
254
|
+
- imported bundle qids fail with an explicit read-only import error
|
|
189
255
|
- `mdkg task done <id-or-qid> [--checkpoint "<title>"] [...]`
|
|
190
256
|
- supports `task`, `bug`, and `test` nodes only
|
|
191
257
|
- sets `status: done`
|
|
@@ -242,6 +308,8 @@ Common flags:
|
|
|
242
308
|
- `mdkg validate`
|
|
243
309
|
- strict frontmatter + graph integrity checks (exit code 2 on failure)
|
|
244
310
|
- validates optional node->skill references
|
|
311
|
+
- validates configured bundle imports and fails on missing/corrupt enabled bundles, malformed import config, duplicate projected ids, and invalid import refs
|
|
312
|
+
- warns, but does not fail, on stale imports
|
|
245
313
|
- validates optional `.mdkg/work/events/events.jsonl` record shape when file exists
|
|
246
314
|
- warns when `.agents/skills/` or `.claude/skills/` drift from canonical `.mdkg/skills/`
|
|
247
315
|
- `mdkg format`
|
|
@@ -21,7 +21,9 @@ mdkg content may contain sensitive notes and internal project planning. This rul
|
|
|
21
21
|
|
|
22
22
|
- `.mdkg/` must not be shipped to production deployments.
|
|
23
23
|
- `.mdkg/` must not be published to npm.
|
|
24
|
-
- `.mdkg/index/` must
|
|
24
|
+
- Generated JSON index, temp, lock, WAL, SHM, and journal files under `.mdkg/index/` must not be committed.
|
|
25
|
+
- `.mdkg/index/mdkg.sqlite` is a rebuildable access cache and may be committed when the repo intentionally tracks it and it stays reasonably small.
|
|
26
|
+
- `.mdkg/bundles/` may be committed only when the repo intentionally tracks private or public snapshot bundles.
|
|
25
27
|
|
|
26
28
|
## Git ignore requirements
|
|
27
29
|
|
|
@@ -29,13 +31,24 @@ The repo MUST ignore at minimum:
|
|
|
29
31
|
|
|
30
32
|
- `node_modules/`
|
|
31
33
|
- `dist/`
|
|
32
|
-
- `.mdkg/index
|
|
34
|
+
- `.mdkg/index/*.json`
|
|
35
|
+
- `.mdkg/index/*.tmp`
|
|
36
|
+
- `.mdkg/index/write.lock/`
|
|
37
|
+
- `.mdkg/index/*.sqlite-wal`
|
|
38
|
+
- `.mdkg/index/*.sqlite-shm`
|
|
39
|
+
- `.mdkg/index/*.sqlite-journal`
|
|
33
40
|
- `.mdkg/pack/`
|
|
41
|
+
- `.mdkg/archive/**/source/`
|
|
34
42
|
|
|
35
43
|
Recommended `.gitignore` entries:
|
|
36
|
-
- `.mdkg/index
|
|
37
|
-
- `.mdkg/index
|
|
44
|
+
- `.mdkg/index/*.json`
|
|
45
|
+
- `.mdkg/index/*.tmp`
|
|
46
|
+
- `.mdkg/index/write.lock/`
|
|
47
|
+
- `.mdkg/index/*.sqlite-wal`
|
|
48
|
+
- `.mdkg/index/*.sqlite-shm`
|
|
49
|
+
- `.mdkg/index/*.sqlite-journal`
|
|
38
50
|
- `.mdkg/pack/`
|
|
51
|
+
- `.mdkg/archive/**/source/`
|
|
39
52
|
|
|
40
53
|
## npm publish safety (required)
|
|
41
54
|
|
|
@@ -57,7 +70,12 @@ Additional belt-and-suspenders:
|
|
|
57
70
|
If the repo is containerized:
|
|
58
71
|
- `.dockerignore` SHOULD exclude:
|
|
59
72
|
- `.mdkg/`
|
|
60
|
-
- `.mdkg/index
|
|
73
|
+
- `.mdkg/index/*.json`
|
|
74
|
+
- `.mdkg/index/*.tmp`
|
|
75
|
+
- `.mdkg/index/write.lock/`
|
|
76
|
+
- `.mdkg/index/*.sqlite-wal`
|
|
77
|
+
- `.mdkg/index/*.sqlite-shm`
|
|
78
|
+
- `.mdkg/index/*.sqlite-journal`
|
|
61
79
|
- `node_modules/`
|
|
62
80
|
- `dist/` (if built in container)
|
|
63
81
|
- any other local artifacts
|
|
@@ -69,8 +87,8 @@ For application builds:
|
|
|
69
87
|
|
|
70
88
|
`mdkg init` updates ignore files by default for safety:
|
|
71
89
|
|
|
72
|
-
- `.gitignore` appends
|
|
73
|
-
- `.npmignore` appends `.mdkg/`,
|
|
90
|
+
- `.gitignore` appends generated index cache/temp/lock patterns, `.mdkg/pack/`, and raw archive source ignores.
|
|
91
|
+
- `.npmignore` appends `.mdkg/`, generated index cache/temp/lock patterns, and `.mdkg/pack/`.
|
|
74
92
|
- `--no-update-ignores` disables these default writes
|
|
75
93
|
|
|
76
94
|
Explicit flags remain available and take precedence:
|
|
@@ -81,11 +99,28 @@ Explicit flags remain available and take precedence:
|
|
|
81
99
|
|
|
82
100
|
## Index safety
|
|
83
101
|
|
|
84
|
-
- `.mdkg/index/`
|
|
85
|
-
-
|
|
86
|
-
-
|
|
102
|
+
- `.mdkg/index/` contains generated caches.
|
|
103
|
+
- JSON index files may contain extracted metadata and could expose sensitive strings; they MUST be ignored from git.
|
|
104
|
+
- `.mdkg/index/mdkg.sqlite` contains the same rebuildable access data and may be committed only by explicit repo policy; `mdkg doctor` warns when it exceeds `index.sqlite_commit_warning_bytes`.
|
|
87
105
|
- Index rebuild should be deterministic and safe to regenerate at any time.
|
|
88
106
|
|
|
107
|
+
## Bundle safety
|
|
108
|
+
|
|
109
|
+
- `.mdkg/bundles/` stores explicit snapshot artifacts and is not ignored by default.
|
|
110
|
+
- Private bundles may include sensitive authored mdkg content and should stay in private repos.
|
|
111
|
+
- Public bundles must be created with `mdkg bundle create --profile public` so private graph, archive, and imported bundle refs fail closed.
|
|
112
|
+
- Public-safe packs must be created with `mdkg pack <id> --visibility public`; internal-safe packs use `--visibility internal`. These filters do not redact Markdown body text.
|
|
113
|
+
- Bundle ZIPs must exclude `.mdkg/pack/`, existing `.mdkg/index/`, nested `.mdkg/bundles/`, and raw `.mdkg/archive/**/source/` files.
|
|
114
|
+
- Repos that track archive caches or bundles should refresh in this order before commit: `mdkg archive compress --all`, `mdkg archive verify --json`, `mdkg bundle create --profile private`, then bundle verify.
|
|
115
|
+
|
|
116
|
+
## Archive safety
|
|
117
|
+
|
|
118
|
+
- Archive sidecar `.md` files and deterministic `.zip` caches are the commit-eligible evidence record.
|
|
119
|
+
- Raw copied sources under `.mdkg/archive/**/source/` stay ignored by default.
|
|
120
|
+
- `mdkg validate` and `mdkg archive verify` must both check ZIP cache hash, ZIP readability, payload hash, and payload byte size.
|
|
121
|
+
- Outside-repo archive sources must be recorded as redacted labels such as `external:key_input_doc.pdf`, not absolute local paths.
|
|
122
|
+
- `mdkg doctor` warns when committed archive ZIP caches exceed `archive.large_cache_warning_bytes`; this is advisory and does not block validation.
|
|
123
|
+
|
|
89
124
|
## Workspace safety
|
|
90
125
|
|
|
91
126
|
Workspace-local `.mdkg/` directories (near code) should follow the same rules:
|
|
@@ -95,7 +130,8 @@ Workspace-local `.mdkg/` directories (near code) should follow the same rules:
|
|
|
95
130
|
|
|
96
131
|
## Summary checklist
|
|
97
132
|
|
|
98
|
-
- ✅
|
|
133
|
+
- ✅ generated JSON index/temp/lock files ignored
|
|
134
|
+
- ✅ `.mdkg/index/mdkg.sqlite` committed only by explicit repo policy
|
|
99
135
|
- ✅ event logs are committed by default unless a repo chooses to ignore them manually
|
|
100
136
|
- ✅ npm publishes only `dist/`, `README.md`, `LICENSE`
|
|
101
137
|
- ✅ optional `.npmignore` excludes `.mdkg/`
|