mdkg 0.4.0 → 0.4.2

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 CHANGED
@@ -8,6 +8,64 @@ mdkg is pre-v1 public alpha software. Command, graph, cache, bundle, and DAL con
8
8
 
9
9
  ## Unreleased
10
10
 
11
+ ## 0.4.2 - 2026-07-05
12
+
13
+ ### Added
14
+
15
+ - Added the low-level `mdkg git` command family for Git-backed project
16
+ lifecycle primitives: `inspect`, `clone`, `fetch`, `closeout`,
17
+ `push-ready`, and approval-gated real `push` execution.
18
+ - Added Git source descriptors and accepted-revision evidence in command
19
+ receipts, including sanitized remote refs, branch, commit SHA, tree hash, and
20
+ the external-auth boundary.
21
+ - Added `mdkg git closeout` static JSON/Markdown receipts, plus sealed project
22
+ DB snapshot and deterministic dump evidence when SQLite project state
23
+ participated in the run.
24
+
25
+ ### Changed
26
+
27
+ - Made push readiness a high-bar preflight: explicit remote and branch,
28
+ credential-free remote config, clean worktree, passing mdkg validation, and a
29
+ valid DB snapshot when DB state participated.
30
+ - Documented Git auth as external to mdkg through system Git, credential
31
+ helpers, SSH, `gh`, CI/runtime env, or shell state; mdkg stores only refs,
32
+ hashes, policy names, and receipts.
33
+ - Deferred project-memory semantic query UX (`history`, `why`, and
34
+ `next-work`) to a separate CocoIndex-grounded design lane instead of shipping
35
+ it in the `0.4.2` Git lifecycle release.
36
+
37
+ ### Security
38
+
39
+ - Rejects embedded URL credentials for repository refs and push remotes, and
40
+ redacts any userinfo that appears in inspected remote URLs before writing
41
+ receipts or JSON output.
42
+
43
+ ## 0.4.1 - 2026-07-04
44
+
45
+ ### Added
46
+
47
+ - Added generic contract-profile metadata for MANIFEST, WORK, WORK_ORDER, and
48
+ RECEIPT semantic mirrors, including `contract_profile`, policy refs,
49
+ `receipt_kind`, and `redaction_class` validation.
50
+ - Added explicit profile validation through `mdkg validate --profile
51
+ omni-room` and `mdkg work validate --profile omni-room`, while keeping Omni
52
+ Room execution semantics runtime-owned.
53
+ - Added scaffold and helper flags for contract-profile metadata across
54
+ `mdkg new manifest|work|work_order|receipt` and `mdkg work
55
+ contract|order|receipt new`.
56
+
57
+ ### Changed
58
+
59
+ - Updated default templates, init assets, seeded skills, and generated command
60
+ references to demonstrate generic contract-profile fields without adding
61
+ runtime-only queue, provider, billing, ledger, or final-receipt state.
62
+ - Documented the distinction between `contract_profile`, MANIFEST
63
+ `resource_profile`, WORK `kind`, WORK_ORDER `artifact_policy`, RECEIPT
64
+ `redaction_policy`, `receipt_kind`, `redaction_class`, and pack/bundle
65
+ `--profile` flags.
66
+ - Expanded release-readiness documentation and checks for `0.4.1` so the
67
+ implementation can hand off to a separate approval-gated publish goal.
68
+
11
69
  ## 0.4.0 - 2026-06-27
12
70
 
13
71
  ### Added
@@ -1,7 +1,7 @@
1
1
  # CLI Command Matrix
2
2
 
3
- as_of: 2026-06-27
4
- package_version_in_source: 0.4.0
3
+ as_of: 2026-07-05
4
+ package_version_in_source: 0.4.2
5
5
  source: live help from `src/cli.ts`, runtime command handlers, and `dec-15`..`dec-18`
6
6
  status: canonical single-source command and flag reference for mdkg
7
7
 
@@ -42,6 +42,7 @@ Primary commands:
42
42
  - `archive`
43
43
  - `bundle`
44
44
  - `graph`
45
+ - `git`
45
46
  - `subgraph`
46
47
  - `work`
47
48
  - `goal`
@@ -72,6 +73,7 @@ Reusable manifest capability records are accessed through `mdkg manifest ...`;
72
73
  Archive sidecars are accessed through `mdkg archive ...`.
73
74
  Full graph snapshot bundles are accessed through `mdkg bundle ...`.
74
75
  Whole-graph clone, fork, and same-repo template import workflows are accessed through `mdkg graph ...`.
76
+ Low-level Git remote lifecycle primitives are accessed through `mdkg git ...`.
75
77
  Read-only child graph orchestration is accessed through `mdkg subgraph ...`.
76
78
  Work contract/order/receipt semantic mirrors are accessed through `mdkg work ...`.
77
79
  Recursive long-running objective contracts are accessed through `mdkg goal ...`.
@@ -213,6 +215,11 @@ Primary flags:
213
215
  - `--skills <slug,slug,...>`
214
216
  - `--template <set>`
215
217
  - `--run-id <id>`
218
+ - `--contract-profile <name>` for MANIFEST, WORK, WORK_ORDER, and RECEIPT
219
+ - `--validation-policy-ref <ref>` for MANIFEST, WORK_ORDER, and RECEIPT
220
+ - `--evidence-policy-ref <ref>` for MANIFEST, WORK_ORDER, and RECEIPT
221
+ - `--receipt-kind <kind>` for RECEIPT
222
+ - `--redaction-class <class>` for RECEIPT
216
223
  - `--json`
217
224
 
218
225
  Advanced metadata flags:
@@ -741,6 +748,54 @@ JSON receipts:
741
748
  - `import-template`: `{ action: "graph.import_template", ok, mode, source, source_hash, preserved_ids: false, rewritten_ids, rewritten_refs, planned_paths, files_written, skipped_paths, start_goal?, selected_goal?, activated_goal?, paused_goals, index?, validation?, warnings }`
742
749
  - `refs`: `{ action: "graph.refs", ok, target, outgoing, incoming, warnings }`
743
750
 
751
+ ### `mdkg git`
752
+
753
+ When to use:
754
+ - inspect the current Git-backed mdkg project and accepted revision evidence
755
+ - clone or fetch real Git remotes through the system Git CLI with external auth
756
+ - close out mdkg state to static receipts before an agent checkpoint commit
757
+ - prove push readiness before any approval-gated real remote push
758
+
759
+ Usage:
760
+ - `mdkg git inspect [--json]`
761
+ - `mdkg git clone <repository-ref> --target <path> [--branch <name>] [--json]`
762
+ - `mdkg git fetch [--remote <name>] [--branch <name>] [--json]`
763
+ - `mdkg git closeout [--queue-policy drain|paused] [--output <path>] [--json]`
764
+ - `mdkg git push-ready --remote <name> --branch <name> [--json]`
765
+ - `mdkg git push --remote <name> --branch <name> [--json]`
766
+ - `mdkg git push --remote <name> --branch <name> --stage-all --message <text> [--queue-policy drain|paused] [--json]`
767
+ - `mdkg git push --remote <name> --branch <name> [--stage-all --message <text>] [--json]`
768
+
769
+ Flags:
770
+ - `--target <path>`
771
+ - `--branch <name>`
772
+ - `--remote <name>`
773
+ - `--queue-policy drain|paused`
774
+ - `--output <path>`
775
+ - `--stage-all`
776
+ - `--message <text>`
777
+ - `--json`
778
+
779
+ Notes:
780
+ - `mdkg git` is a low-level lifecycle surface, not project-memory semantic search
781
+ - v1 uses the system Git CLI; authentication stays external through credential helpers, SSH, `gh`, CI/runtime env, or shell state
782
+ - mdkg rejects repository refs and push remotes with embedded URL credentials; inspected remotes with userinfo are redacted before receipts are printed
783
+ - `git inspect` is read-only and emits sanitized source descriptors plus accepted-revision hashes
784
+ - `git clone` writes only to an empty or absent contained `--target`; use `mdkg graph clone|fork` for bundle/template graph transport
785
+ - `git closeout` validates mdkg state and writes static JSON and Markdown receipts under `.mdkg/git/closeouts` by default
786
+ - when the project DB participated, `git closeout` also seals `.mdkg/db/state/project.sqlite` and writes a deterministic dump
787
+ - `git push-ready` is read-only and requires explicit remote and branch, clean worktree, passing mdkg validation, external-auth-safe remote config, and a valid DB snapshot when DB state participated
788
+ - `git push --stage-all` writes closeout evidence, stages all changes, commits with `--message`, reruns push-ready, then pushes `HEAD` to the explicit remote branch
789
+ - real `git push` should remain approval-gated by the calling runtime or human operator
790
+
791
+ JSON receipts:
792
+ - `inspect`: `{ action: "git.inspect", ok, root, inside_work_tree, branch, head_sha, tree_hash, remotes, status, source_descriptor, accepted_revision, warnings }`
793
+ - `clone`: `{ action: "git.clone", ok, repository_ref, target, branch, source_descriptor, accepted_revision, inspect, warnings }`
794
+ - `fetch`: `{ action: "git.fetch", ok, remote, branch, fetch_output, inspect, warnings }`
795
+ - `closeout`: `{ action: "git.closeout", ok, root, output_dir, generated_at, git, validation, db_participated, db_snapshot_status, db_snapshot_seal, db_snapshot_dump, static_receipts, warnings }`
796
+ - `push-ready`: `{ action: "git.push_ready", ok, root, remote, branch, remote_url, git, validation, db_snapshot_status, checks, warning_count, failure_count, warnings, errors }`
797
+ - `push`: `{ action: "git.push", ok, remote, branch, head_sha, pushed_ref, stage_all, closeout, commit, push_ready, push_output, warnings }`
798
+
744
799
  ### `mdkg subgraph`
745
800
 
746
801
  When to use:
@@ -819,17 +874,17 @@ Usage:
819
874
  - `mdkg work order new|status|update ...`
820
875
  - `mdkg work receipt new|verify|update ...`
821
876
  - `mdkg work artifact add ...`
822
- - `mdkg work contract new "<title>" --id <work.id> --agent-id <agent.id> --kind <kind> --inputs <...> --outputs <...> [--required-capabilities <...>] [--pricing-model <...>] [--json]`
877
+ - `mdkg work contract new "<title>" --id <work.id> --agent-id <agent.id> --kind <kind> --inputs <...> --outputs <...> [--contract-profile <name>] [--required-capabilities <...>] [--pricing-model <...>] [--json]`
823
878
  - `mdkg work trigger <work-or-capability-ref> [--id <order.id>] [--title "<title>"] [--requester <ref>] [--enqueue <queue>] [--json]`
824
- - `mdkg work order new "<title>" --id <order.id> --work-id <work.id> --requester <ref> [--request-ref <ref>] [--trigger-ref <ref>] [--payload-hash <sha256:...>] [--input-refs <...>] [--queue-refs <...>] [--requested-outputs <...>] [--json]`
879
+ - `mdkg work order new "<title>" --id <order.id> --work-id <work.id> --requester <ref> [--contract-profile <name>] [--validation-policy-ref <ref>] [--evidence-policy-ref <ref>] [--request-ref <ref>] [--trigger-ref <ref>] [--payload-hash <sha256:...>] [--input-refs <...>] [--queue-refs <...>] [--requested-outputs <...>] [--json]`
825
880
  - `mdkg work order status <id-or-qid> [--json]`
826
881
  - `mdkg work order update <id-or-qid> [--status <status>] [--add-input-refs <...>] [--add-queue-refs <...>] [--add-artifacts <...>] [--json]`
827
- - `mdkg work receipt new "<title>" --id <receipt.id> --work-order-id <order.id> --outcome success|partial|failure [--receipt-status recorded|verified|rejected|superseded] [--redaction-policy refs_and_hashes_only|redacted_summary|external_private] [--evidence-hashes <sha256:...>] [--json]`
882
+ - `mdkg work receipt new "<title>" --id <receipt.id> --work-order-id <order.id> --outcome success|partial|failure [--receipt-status recorded|verified|rejected|superseded] [--redaction-policy refs_and_hashes_only|redacted_summary|external_private] [--contract-profile <name>] [--receipt-kind <kind>] [--redaction-class <class>] [--validation-policy-ref <ref>] [--evidence-policy-ref <ref>] [--evidence-hashes <sha256:...>] [--json]`
828
883
  - `mdkg work receipt verify <id-or-qid> [--json]`
829
884
  - `mdkg work receipt update <id-or-qid> [--receipt-status <status>] [--add-artifacts <...>] [--add-proof-refs <...>] [--add-attestation-refs <...>] [--add-evidence-hashes <sha256:...>] [--json]`
830
885
  - `mdkg work artifact add <order-or-receipt-id-or-qid> <file> [--id <archive.id>] [--kind source|artifact] [--json]`
831
- - `mdkg work validate [<id-or-qid>] [--type <workflow-type>] [--json]`
832
- - `mdkg work validate [<id-or-qid>] [--type manifest|spec|work|work_order|receipt|feedback|dispute|proposal] [--json]`
886
+ - `mdkg work validate [<id-or-qid>] [--type <workflow-type>] [--profile <name>] [--json]`
887
+ - `mdkg work validate [<id-or-qid>] [--type manifest|spec|work|work_order|receipt|feedback|dispute|proposal] [--profile <name>] [--json]`
833
888
 
834
889
  Notes:
835
890
  - work commands mutate semantic mirror files only
@@ -840,10 +895,13 @@ Notes:
840
895
  - example: `mdkg work trigger work.example --id order.example-1 --requester user://example --json`
841
896
  - `work trigger --enqueue <queue>` requires a valid project DB plus an explicitly created active queue, creates a submitted order mirror, and enqueues a local delivery message without executing work
842
897
  - `work order new` accepts URI-style requester/request/trigger refs, archive input refs, optional queue refs, and stable payload hashes
898
+ - `work order new` accepts optional contract-profile and validation/evidence policy refs without executing work
843
899
  - `work order status` is read-only and reports deterministic order state plus linked receipts
844
900
  - `work receipt new` accepts URI-style cost/proof/attestation refs, explicit redaction policy, and SHA-256 evidence/input/output hash refs
901
+ - `work receipt new` accepts optional contract-profile, receipt-kind, redaction-class, and validation/evidence policy refs without becoming canonical runtime receipt state
845
902
  - `work receipt verify` is read-only and reports linkage, evidence, archive ref, hash, outcome, and redaction-policy checks; invalid receipts print JSON before exiting nonzero
846
903
  - `work validate` is read-only and reports typed diagnostics for MANIFEST.md, legacy SPEC.md, WORK.md, WORK_ORDER.md, RECEIPT.md, FEEDBACK.md, DISPUTE.md, and PROPOSAL.md mirrors; obvious raw secret, prompt, token, or payload markers are warnings, not hard failures
904
+ - `work validate --profile omni-room` applies explicit contract-profile validation after generic mirror validation; it is separate from `mdkg pack --profile`
847
905
  - `work artifact add` calls `mdkg archive add`, then attaches the resulting `archive://...` ref to the target order or receipt
848
906
  - `work order update`, `work receipt update`, and `work artifact add` accept local ids or local qids; subgraph qids are read-only and must be changed in their source workspace
849
907
 
@@ -990,10 +1048,11 @@ When to use:
990
1048
  - run the repo trust gate before calling work done
991
1049
 
992
1050
  Usage:
993
- - `mdkg validate [--out <path>] [--json-out <path>] [--quiet] [--changed-only] [--summary] [--limit <n>] [--json]`
1051
+ - `mdkg validate [--out <path>] [--json-out <path>] [--quiet] [--changed-only] [--summary] [--limit <n>] [--profile <name>] [--json]`
994
1052
  - `--changed-only` filters warning presentation to changed `.mdkg` files while full graph errors still run
995
1053
  - `--summary` emits bounded warning samples for agent/CI logs; `--limit <n>` controls the sample size
996
1054
  - `--out <path>` writes the compatibility text report; `--json-out <path>` writes a clean full JSON receipt
1055
+ - `--profile omni-room` applies explicit contract-profile validation after generic validation; it is separate from `mdkg pack --profile`
997
1056
  - JSON receipts include `warning_summary` and `warning_diagnostics` with warning ids, categories, severity, paths, refs, and remediation text
998
1057
 
999
1058
  Flags:
@@ -1003,10 +1062,11 @@ Flags:
1003
1062
  - `--changed-only`
1004
1063
  - `--summary`
1005
1064
  - `--limit <n>`
1065
+ - `--profile <name>`
1006
1066
  - `--json`
1007
1067
 
1008
1068
  JSON receipt:
1009
- - `{ action: "validated", ok, warning_count, error_count, warnings, warning_diagnostics, warning_summary, errors, report_path?, json_receipt_path? }`
1069
+ - `{ action: "validated", ok, warning_count, error_count, warnings, warning_diagnostics, warning_summary, errors, validation_profile?, report_path?, json_receipt_path? }`
1010
1070
  - `report_path` is included only when `--out` is used.
1011
1071
  - `json_receipt_path` is included only when `--json-out` is used.
1012
1072
 
package/README.md CHANGED
@@ -14,7 +14,7 @@ mdkg stays deliberately boring:
14
14
  - first-class rebuildable SQLite cache through built-in `node:sqlite`
15
15
  - no daemon, hosted index, or vector DB
16
16
 
17
- Current package version in source: `0.4.0`
17
+ Current package version in source: `0.4.2`
18
18
 
19
19
  mdkg is still pre-v1 public alpha software. The public package is usable, but graph, cache, bundle, and DAL contracts may continue to change quickly while the project converges on a stable v1 surface.
20
20
 
@@ -242,6 +242,26 @@ Subgraph nodes are projected under the subgraph alias, for example `child_repo:t
242
242
 
243
243
  Use `mdkg graph refs <id-or-qid> --json` to inspect inbound and outbound scope, context, evidence, blocker, related, and structural links for local or read-only subgraph qids without mutating either graph.
244
244
 
245
+ Use low-level Git lifecycle receipts when an agent run needs to close out local
246
+ mdkg state and prove push readiness before an explicit remote update:
247
+
248
+ ```bash
249
+ mdkg git inspect --json
250
+ mdkg git clone git@github.com:org/repo.git --target worktrees/repo --branch main --json
251
+ mdkg git fetch --remote origin --branch main --json
252
+ mdkg git closeout --json
253
+ mdkg git push-ready --remote origin --branch main --json
254
+ mdkg git push --remote origin --branch main --stage-all --message "agent checkpoint" --json
255
+ ```
256
+
257
+ `mdkg git` uses the system Git CLI. Authentication stays external through SSH,
258
+ credential helpers, `gh`, CI/runtime environment, or shell state; mdkg rejects
259
+ embedded URL credentials and records only sanitized refs, hashes, policy names,
260
+ and receipts. `closeout` validates mdkg state before writing static JSON and
261
+ Markdown receipts, and when the project DB participated it also seals the
262
+ SQLite state and writes a deterministic dump. Treat real `mdkg git push` as an
263
+ approval-gated operation in agent runtimes.
264
+
245
265
  Launch a local read-only MCP server when an MCP-capable agent should inspect a
246
266
  specific mdkg graph without receiving mutation tools:
247
267
 
@@ -600,7 +620,11 @@ Use `mdkg new manifest|work|work_order|receipt|feedback|dispute|proposal "<title
600
620
 
601
621
  Relational templates contain editable placeholder refs. `manifest` and `work` scaffold as validation-clean standalone docs; `work_order`, `receipt`, `feedback`, `dispute`, and `proposal` need real refs before strict `mdkg validate` passes.
602
622
 
603
- For executable or purchasable capability mirrors, prefer the lifecycle helpers under `mdkg work ...`. They create and update `WORK.md`, `WORK_ORDER.md`, and `RECEIPT.md` semantic mirror files only. `mdkg work trigger` creates a deterministic submitted `WORK_ORDER.md` from a WORK contract or a MANIFEST with exactly one resolvable work contract; legacy SPEC refs remain supported during the compatibility bridge. `mdkg work order status` and `mdkg work receipt verify` are read-only review helpers for deterministic closeout. `mdkg work validate [<id-or-qid>] [--type manifest|spec|work|work_order|receipt|feedback|dispute|proposal] --json` is a read-only focused validator for agent workflow mirrors; it returns typed diagnostics and warns on obvious raw secret, prompt, token, or payload markers. `mdkg work trigger --enqueue <queue>` optionally writes a local project DB queue delivery message after the queue has been explicitly created and is active; it still does not execute work. Production order state, receipt state, feedback, disputes, payments, ledgers, marketplace inventory, fulfillment records, and execution state remain canonical outside mdkg, such as in Postgres or another application database. Do not store raw secrets, credentials, live payment state, ledger mutations, canonical marketplace state, or bulky raw payloads in these mirrors.
623
+ For executable or purchasable capability mirrors, prefer the lifecycle helpers under `mdkg work ...`. They create and update `WORK.md`, `WORK_ORDER.md`, and `RECEIPT.md` semantic mirror files only. `mdkg work trigger` creates a deterministic submitted `WORK_ORDER.md` from a WORK contract or a MANIFEST with exactly one resolvable work contract; legacy SPEC refs remain supported during the compatibility bridge. `mdkg work order status` and `mdkg work receipt verify` are read-only review helpers for deterministic closeout. `mdkg work validate [<id-or-qid>] [--type manifest|spec|work|work_order|receipt|feedback|dispute|proposal] [--profile omni-room] --json` is a read-only focused validator for agent workflow mirrors; it returns typed diagnostics and warns on obvious raw secret, prompt, token, or payload markers. `mdkg validate --profile omni-room` and `mdkg work validate --profile omni-room` apply explicit profile checks after generic validation.
624
+
625
+ Optional contract-profile fields are generic semantic mirrors, not runtime execution state. `contract_profile` is accepted on MANIFEST, WORK, WORK_ORDER, and RECEIPT surfaces; `validation_policy_ref` and `evidence_policy_ref` are accepted on MANIFEST, WORK_ORDER, and RECEIPT; `receipt_kind` and `redaction_class` are RECEIPT-only. These fields are separate from MANIFEST `resource_profile`, WORK `kind`, WORK_ORDER `artifact_policy`, RECEIPT `redaction_policy`, and pack/bundle `--profile` flags. Generic validation accepts well-shaped custom profile, kind, and class values with warnings; explicit `--profile omni-room` validation escalates unknown or incompatible values. Bare `profile` is intentionally ambiguous and is diagnosed rather than treated as an alias.
626
+
627
+ `mdkg work trigger --enqueue <queue>` optionally writes a local project DB queue delivery message after the queue has been explicitly created and is active; it still does not execute work. Production order state, receipt state, feedback, disputes, payments, ledgers, marketplace inventory, fulfillment records, and execution state remain canonical outside mdkg, such as in Postgres or another application database. Omni Room and other downstream runtimes own runtime policy, queue execution, final receipt normalization, and downstream adoption. Do not store raw secrets, credentials, live payment state, ledger mutations, canonical marketplace state, or bulky raw payloads in these mirrors.
604
628
 
605
629
  ## Archive sidecars
606
630
 
package/dist/cli.js CHANGED
@@ -29,6 +29,7 @@ const spec_1 = require("./commands/spec");
29
29
  const archive_1 = require("./commands/archive");
30
30
  const bundle_1 = require("./commands/bundle");
31
31
  const graph_1 = require("./commands/graph");
32
+ const git_1 = require("./commands/git");
32
33
  const subgraph_1 = require("./commands/subgraph");
33
34
  const checkpoint_1 = require("./commands/checkpoint");
34
35
  const init_1 = require("./commands/init");
@@ -76,6 +77,7 @@ function printUsage(log) {
76
77
  log(" archive Add, list, show, verify, and compress archive sidecars");
77
78
  log(" bundle Create, list, show, and verify full graph snapshot bundles");
78
79
  log(" graph Clone, fork, import, and inspect mdkg graph references");
80
+ log(" git Clone, fetch, inspect, close out, and push Git-backed mdkg projects");
79
81
  log(" subgraph Register, audit, plan, sync, materialize, and verify read-only child graph snapshots");
80
82
  log(" work Create and update work contracts, orders, receipts, and artifacts");
81
83
  log(" goal Inspect and advance recursive goal nodes");
@@ -160,6 +162,11 @@ function printNewHelp(log) {
160
162
  log(" --skills <slug,slug,...> Skill slugs for work items");
161
163
  log(" --template <set> Template set");
162
164
  log(" --run-id <id> Optional event run id when event logging is enabled");
165
+ log(" --contract-profile <name> Optional MANIFEST/WORK/WORK_ORDER/RECEIPT validation profile metadata");
166
+ log(" --validation-policy-ref <ref> Optional MANIFEST/WORK_ORDER/RECEIPT validation policy ref");
167
+ log(" --evidence-policy-ref <ref> Optional MANIFEST/WORK_ORDER/RECEIPT evidence policy ref");
168
+ log(" --receipt-kind <kind> Optional RECEIPT kind metadata");
169
+ log(" --redaction-class <class> Optional RECEIPT redaction class metadata");
163
170
  log("\nAdvanced metadata flags:");
164
171
  log(" --parent --prev --next --relates --blocked-by --blocks");
165
172
  log(" --links --artifacts --refs --aliases --owners --cases --supersedes");
@@ -648,6 +655,70 @@ function printGraphHelp(log, subcommand) {
648
655
  }
649
656
  printGlobalOptions(log);
650
657
  }
658
+ function printGitHelp(log, subcommand) {
659
+ switch ((subcommand ?? "").toLowerCase()) {
660
+ case "inspect":
661
+ log("Usage:");
662
+ log(" mdkg git inspect [--json]");
663
+ log("\nNotes:");
664
+ log(" - read-only Git worktree, remote, branch, status, descriptor, and accepted-revision receipt");
665
+ log(" - remote URLs are redacted when userinfo is present");
666
+ break;
667
+ case "clone":
668
+ log("Usage:");
669
+ log(" mdkg git clone <repository-ref> --target <path> [--branch <name>] [--json]");
670
+ log("\nNotes:");
671
+ log(" - uses the system Git CLI and external Git auth");
672
+ log(" - --target must be empty or absent and stay inside the current repo");
673
+ log(" - repository refs must not embed credentials");
674
+ break;
675
+ case "fetch":
676
+ log("Usage:");
677
+ log(" mdkg git fetch [--remote <name>] [--branch <name>] [--json]");
678
+ log("\nNotes:");
679
+ log(" - defaults to remote origin");
680
+ log(" - auth stays external through Git credential helpers, SSH, gh, CI env, or shell state");
681
+ break;
682
+ case "closeout":
683
+ log("Usage:");
684
+ log(" mdkg git closeout [--queue-policy drain|paused] [--output <path>] [--json]");
685
+ log("\nNotes:");
686
+ log(" - validates mdkg state before writing closeout receipts");
687
+ log(" - when the project DB participated, seals SQLite state and writes a deterministic dump");
688
+ log(" - writes static JSON and Markdown receipts under .mdkg/git/closeouts by default");
689
+ break;
690
+ case "push-ready":
691
+ log("Usage:");
692
+ log(" mdkg git push-ready --remote <name> --branch <name> [--json]");
693
+ log("\nNotes:");
694
+ log(" - read-only high-bar preflight for explicit Git remote/branch push");
695
+ log(" - requires clean worktree, valid mdkg graph, external auth boundary, and valid DB snapshot when DB state participated");
696
+ break;
697
+ case "push":
698
+ log("Usage:");
699
+ log(" mdkg git push --remote <name> --branch <name> [--json]");
700
+ log(" mdkg git push --remote <name> --branch <name> --stage-all --message <text> [--queue-policy drain|paused] [--json]");
701
+ log("\nNotes:");
702
+ log(" - real Git push via system Git; requires explicit remote and branch");
703
+ log(" - --stage-all writes closeout evidence, stages all changes, commits with --message, then runs push-ready before pushing");
704
+ log(" - no raw credentials, tokens, SSH keys, prompts, payloads, or provider auth are stored in receipts");
705
+ break;
706
+ default:
707
+ log("Usage:");
708
+ log(" mdkg git inspect [--json]");
709
+ log(" mdkg git clone <repository-ref> --target <path> [--branch <name>] [--json]");
710
+ log(" mdkg git fetch [--remote <name>] [--branch <name>] [--json]");
711
+ log(" mdkg git closeout [--queue-policy drain|paused] [--output <path>] [--json]");
712
+ log(" mdkg git push-ready --remote <name> --branch <name> [--json]");
713
+ log(" mdkg git push --remote <name> --branch <name> [--stage-all --message <text>] [--json]");
714
+ log("\nBoundaries:");
715
+ log(" - mdkg git is a low-level Git lifecycle surface, not project-memory semantic search");
716
+ log(" - system Git is the v1 execution backend");
717
+ log(" - authentication stays external; mdkg records only refs, hashes, policy names, and receipts");
718
+ log(" - real push operations require explicit remote and branch and should be approval-gated by the caller");
719
+ }
720
+ printGlobalOptions(log);
721
+ }
651
722
  function printSubgraphHelp(log, subcommand) {
652
723
  switch ((subcommand ?? "").toLowerCase()) {
653
724
  case "add":
@@ -733,7 +804,7 @@ function printWorkHelp(log, subcommand) {
733
804
  switch ((subcommand ?? "").toLowerCase()) {
734
805
  case "contract":
735
806
  log("Usage:");
736
- log(' mdkg work contract new "<title>" --id <work.id> --agent-id <agent.id> --kind <kind> --inputs <...> --outputs <...> [--required-capabilities <...>] [--pricing-model <...>] [--json]');
807
+ log(' mdkg work contract new "<title>" --id <work.id> --agent-id <agent.id> --kind <kind> --inputs <...> --outputs <...> [--contract-profile <name>] [--required-capabilities <...>] [--pricing-model <...>] [--json]');
737
808
  break;
738
809
  case "trigger":
739
810
  log("Usage:");
@@ -747,7 +818,7 @@ function printWorkHelp(log, subcommand) {
747
818
  break;
748
819
  case "order":
749
820
  log("Usage:");
750
- log(' mdkg work order new "<title>" --id <order.id> --work-id <work.id> --requester <ref> [--request-ref <ref>] [--trigger-ref <ref>] [--payload-hash <sha256:...>] [--input-refs <...>] [--queue-refs <...>] [--requested-outputs <...>] [--json]');
821
+ log(' mdkg work order new "<title>" --id <order.id> --work-id <work.id> --requester <ref> [--contract-profile <name>] [--validation-policy-ref <ref>] [--evidence-policy-ref <ref>] [--request-ref <ref>] [--trigger-ref <ref>] [--payload-hash <sha256:...>] [--input-refs <...>] [--queue-refs <...>] [--requested-outputs <...>] [--json]');
751
822
  log(" mdkg work order status <id-or-qid> [--json]");
752
823
  log(" mdkg work order update <id-or-qid> [--status <status>] [--add-input-refs <...>] [--add-queue-refs <...>] [--add-artifacts <...>] [--json]");
753
824
  log("\nNotes:");
@@ -755,7 +826,7 @@ function printWorkHelp(log, subcommand) {
755
826
  break;
756
827
  case "receipt":
757
828
  log("Usage:");
758
- log(' mdkg work receipt new "<title>" --id <receipt.id> --work-order-id <order.id> --outcome success|partial|failure [--receipt-status recorded|verified|rejected|superseded] [--redaction-policy refs_and_hashes_only|redacted_summary|external_private] [--evidence-hashes <sha256:...>] [--json]');
829
+ log(' mdkg work receipt new "<title>" --id <receipt.id> --work-order-id <order.id> --outcome success|partial|failure [--receipt-status recorded|verified|rejected|superseded] [--redaction-policy refs_and_hashes_only|redacted_summary|external_private] [--contract-profile <name>] [--receipt-kind <kind>] [--redaction-class <class>] [--validation-policy-ref <ref>] [--evidence-policy-ref <ref>] [--evidence-hashes <sha256:...>] [--json]');
759
830
  log(" mdkg work receipt verify <id-or-qid> [--json]");
760
831
  log(" mdkg work receipt update <id-or-qid> [--receipt-status <status>] [--add-artifacts <...>] [--add-proof-refs <...>] [--add-attestation-refs <...>] [--add-evidence-hashes <sha256:...>] [--json]");
761
832
  log("\nNotes:");
@@ -767,10 +838,11 @@ function printWorkHelp(log, subcommand) {
767
838
  break;
768
839
  case "validate":
769
840
  log("Usage:");
770
- log(" mdkg work validate [<id-or-qid>] [--type manifest|spec|work|work_order|receipt|feedback|dispute|proposal] [--json]");
841
+ log(" mdkg work validate [<id-or-qid>] [--type manifest|spec|work|work_order|receipt|feedback|dispute|proposal] [--profile <name>] [--json]");
771
842
  log("\nNotes:");
772
843
  log(" Read-only focused validation for agent workflow mirrors.");
773
844
  log(" Reports typed diagnostics for MANIFEST.md, legacy SPEC.md, WORK.md, WORK_ORDER.md, RECEIPT.md, FEEDBACK.md, DISPUTE.md, and PROPOSAL.md files.");
845
+ log(" --profile omni-room applies explicit contract-profile validation after generic mirror validation; this is separate from mdkg pack --profile.");
774
846
  log(" Obvious raw secret, prompt, token, or payload markers are warnings so humans and agents can review boundaries.");
775
847
  break;
776
848
  default:
@@ -780,7 +852,7 @@ function printWorkHelp(log, subcommand) {
780
852
  log(" mdkg work order new|status|update ...");
781
853
  log(" mdkg work receipt new|verify|update ...");
782
854
  log(" mdkg work artifact add ...");
783
- log(" mdkg work validate [<id-or-qid>] [--type <workflow-type>] [--json]");
855
+ log(" mdkg work validate [<id-or-qid>] [--type <workflow-type>] [--profile <name>] [--json]");
784
856
  log("\nNotes:");
785
857
  log(" - work commands mutate semantic mirror files only");
786
858
  log(" - work validate is read-only and reports typed workflow diagnostics");
@@ -972,10 +1044,11 @@ function printCheckpointHelp(log) {
972
1044
  }
973
1045
  function printValidateHelp(log) {
974
1046
  log("Usage:");
975
- log(" mdkg validate [--out <path>] [--json-out <path>] [--quiet] [--changed-only] [--summary] [--limit <n>] [--json]");
1047
+ log(" mdkg validate [--out <path>] [--json-out <path>] [--quiet] [--changed-only] [--summary] [--limit <n>] [--profile <name>] [--json]");
976
1048
  log("\nNotes:");
977
1049
  log(" Validates frontmatter schemas, graph references, visibility, skills, and events.");
978
1050
  log(" --changed-only filters warning presentation to changed .mdkg files while full graph errors still run.");
1051
+ log(" --profile omni-room applies explicit contract-profile validation after generic validation; this is separate from mdkg pack --profile.");
979
1052
  log(" JSON output includes warning_summary plus warning_diagnostics with warning ids, categories, severity, paths, refs, and remediation text.");
980
1053
  log(" --summary emits bounded warning samples for agent/CI logs; --limit controls the sample size.");
981
1054
  log(" --out writes the compatibility text report; --json-out writes a clean full JSON receipt.");
@@ -1172,6 +1245,9 @@ function printCommandHelp(log, command, subcommand) {
1172
1245
  case "graph":
1173
1246
  printGraphHelp(log, subcommand);
1174
1247
  return;
1248
+ case "git":
1249
+ printGitHelp(log, subcommand);
1250
+ return;
1175
1251
  case "subgraph":
1176
1252
  printSubgraphHelp(log, subcommand);
1177
1253
  return;
@@ -1904,6 +1980,73 @@ function runGraphSubcommand(parsed, root) {
1904
1980
  throw new errors_1.UsageError("graph requires clone/fork/import-template/refs");
1905
1981
  }
1906
1982
  }
1983
+ function runGitSubcommand(parsed, root) {
1984
+ const subcommand = (parsed.positionals[1] ?? "").toLowerCase();
1985
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
1986
+ switch (subcommand) {
1987
+ case "inspect": {
1988
+ if (parsed.positionals.length > 2) {
1989
+ throw new errors_1.UsageError("git inspect does not accept positional arguments");
1990
+ }
1991
+ (0, git_1.runGitInspectCommand)({ root, json });
1992
+ return 0;
1993
+ }
1994
+ case "clone": {
1995
+ const repository = parsed.positionals[2];
1996
+ if (!repository || parsed.positionals.length > 3) {
1997
+ throw new errors_1.UsageError("git clone requires <repository-ref>");
1998
+ }
1999
+ const target = requireFlagValue("--target", parsed.flags["--target"]);
2000
+ if (!target) {
2001
+ throw new errors_1.UsageError("git clone requires --target <path>");
2002
+ }
2003
+ const branch = requireFlagValue("--branch", parsed.flags["--branch"]);
2004
+ (0, git_1.runGitCloneCommand)({ root, repository, target, branch, json });
2005
+ return 0;
2006
+ }
2007
+ case "fetch": {
2008
+ if (parsed.positionals.length > 2) {
2009
+ throw new errors_1.UsageError("git fetch does not accept positional arguments");
2010
+ }
2011
+ const remote = requireFlagValue("--remote", parsed.flags["--remote"]);
2012
+ const branch = requireFlagValue("--branch", parsed.flags["--branch"]);
2013
+ (0, git_1.runGitFetchCommand)({ root, remote, branch, json });
2014
+ return 0;
2015
+ }
2016
+ case "closeout": {
2017
+ if (parsed.positionals.length > 2) {
2018
+ throw new errors_1.UsageError("git closeout does not accept positional arguments");
2019
+ }
2020
+ const queuePolicy = parseQueuePolicyFlag(parsed.flags["--queue-policy"]);
2021
+ const output = requireFlagValue("--output", parsed.flags["--out"]);
2022
+ (0, git_1.runGitCloseoutCommand)({ root, queuePolicy, output, json });
2023
+ return 0;
2024
+ }
2025
+ case "push-ready": {
2026
+ if (parsed.positionals.length > 2) {
2027
+ throw new errors_1.UsageError("git push-ready does not accept positional arguments");
2028
+ }
2029
+ const remote = requireFlagValue("--remote", parsed.flags["--remote"]);
2030
+ const branch = requireFlagValue("--branch", parsed.flags["--branch"]);
2031
+ (0, git_1.runGitPushReadyCommand)({ root, remote, branch, json });
2032
+ return 0;
2033
+ }
2034
+ case "push": {
2035
+ if (parsed.positionals.length > 2) {
2036
+ throw new errors_1.UsageError("git push does not accept positional arguments");
2037
+ }
2038
+ const remote = requireFlagValue("--remote", parsed.flags["--remote"]);
2039
+ const branch = requireFlagValue("--branch", parsed.flags["--branch"]);
2040
+ const message = requireFlagValue("--message", parsed.flags["--message"]);
2041
+ const stageAll = parseBooleanFlag("--stage-all", parsed.flags["--stage-all"]);
2042
+ const queuePolicy = parseQueuePolicyFlag(parsed.flags["--queue-policy"]);
2043
+ (0, git_1.runGitPushCommand)({ root, remote, branch, message, stageAll, queuePolicy, json });
2044
+ return 0;
2045
+ }
2046
+ default:
2047
+ throw new errors_1.UsageError("git requires inspect/clone/fetch/closeout/push-ready/push");
2048
+ }
2049
+ }
1907
2050
  function runSubgraphSubcommand(parsed, root) {
1908
2051
  const subcommand = (parsed.positionals[1] ?? "").toLowerCase();
1909
2052
  const json = parseBooleanFlag("--json", parsed.flags["--json"]);
@@ -2063,7 +2206,8 @@ function runWorkSubcommand(parsed, root) {
2063
2206
  throw new errors_1.UsageError("work validate accepts at most one workflow reference");
2064
2207
  }
2065
2208
  const type = requireFlagValue("--type", parsed.flags["--type"]);
2066
- (0, work_1.runWorkValidateCommand)({ root, ws, id, type, json });
2209
+ const profile = requireFlagValue("--profile", parsed.flags["--pack-profile"]);
2210
+ (0, work_1.runWorkValidateCommand)({ root, ws, id, type, profile, json });
2067
2211
  return 0;
2068
2212
  }
2069
2213
  if (domain === "contract" && action === "new") {
@@ -2078,6 +2222,7 @@ function runWorkSubcommand(parsed, root) {
2078
2222
  }
2079
2223
  const requiredCapabilities = requireFlagValue("--required-capabilities", parsed.flags["--required-capabilities"]);
2080
2224
  const pricingModel = requireFlagValue("--pricing-model", parsed.flags["--pricing-model"]);
2225
+ const contractProfile = requireFlagValue("--contract-profile", parsed.flags["--contract-profile"]);
2081
2226
  (0, work_1.runWorkContractNewCommand)({
2082
2227
  root,
2083
2228
  ws,
@@ -2089,6 +2234,7 @@ function runWorkSubcommand(parsed, root) {
2089
2234
  outputs,
2090
2235
  requiredCapabilities,
2091
2236
  pricingModel,
2237
+ contractProfile,
2092
2238
  json,
2093
2239
  });
2094
2240
  return 0;
@@ -2108,6 +2254,9 @@ function runWorkSubcommand(parsed, root) {
2108
2254
  const queueRefs = requireFlagValue("--queue-refs", parsed.flags["--queue-refs"]);
2109
2255
  const requestedOutputs = requireFlagValue("--requested-outputs", parsed.flags["--requested-outputs"]);
2110
2256
  const constraintRefs = requireFlagValue("--constraint-refs", parsed.flags["--constraint-refs"]);
2257
+ const contractProfile = requireFlagValue("--contract-profile", parsed.flags["--contract-profile"]);
2258
+ const validationPolicyRef = requireFlagValue("--validation-policy-ref", parsed.flags["--validation-policy-ref"]);
2259
+ const evidencePolicyRef = requireFlagValue("--evidence-policy-ref", parsed.flags["--evidence-policy-ref"]);
2111
2260
  (0, work_1.runWorkOrderNewCommand)({
2112
2261
  root,
2113
2262
  ws,
@@ -2122,6 +2271,9 @@ function runWorkSubcommand(parsed, root) {
2122
2271
  queueRefs,
2123
2272
  requestedOutputs,
2124
2273
  constraintRefs,
2274
+ contractProfile,
2275
+ validationPolicyRef,
2276
+ evidencePolicyRef,
2125
2277
  json,
2126
2278
  });
2127
2279
  return 0;
@@ -2163,6 +2315,11 @@ function runWorkSubcommand(parsed, root) {
2163
2315
  const evidenceHashes = requireFlagValue("--evidence-hashes", parsed.flags["--evidence-hashes"]);
2164
2316
  const inputHashes = requireFlagValue("--input-hashes", parsed.flags["--input-hashes"]);
2165
2317
  const outputHashes = requireFlagValue("--output-hashes", parsed.flags["--output-hashes"]);
2318
+ const contractProfile = requireFlagValue("--contract-profile", parsed.flags["--contract-profile"]);
2319
+ const receiptKind = requireFlagValue("--receipt-kind", parsed.flags["--receipt-kind"]);
2320
+ const redactionClass = requireFlagValue("--redaction-class", parsed.flags["--redaction-class"]);
2321
+ const validationPolicyRef = requireFlagValue("--validation-policy-ref", parsed.flags["--validation-policy-ref"]);
2322
+ const evidencePolicyRef = requireFlagValue("--evidence-policy-ref", parsed.flags["--evidence-policy-ref"]);
2166
2323
  (0, work_1.runWorkReceiptNewCommand)({
2167
2324
  root,
2168
2325
  ws,
@@ -2173,6 +2330,11 @@ function runWorkSubcommand(parsed, root) {
2173
2330
  receiptStatus,
2174
2331
  costRef,
2175
2332
  redactionPolicy,
2333
+ contractProfile,
2334
+ receiptKind,
2335
+ redactionClass,
2336
+ validationPolicyRef,
2337
+ evidencePolicyRef,
2176
2338
  artifacts,
2177
2339
  proofRefs,
2178
2340
  attestationRefs,
@@ -2657,6 +2819,11 @@ function runCommand(parsed, root, runtime) {
2657
2819
  const owners = requireFlagValue("--owners", parsed.flags["--owners"]);
2658
2820
  const supersedes = requireFlagValue("--supersedes", parsed.flags["--supersedes"]);
2659
2821
  const template = requireFlagValue("--template", parsed.flags["--template"]);
2822
+ const contractProfile = requireFlagValue("--contract-profile", parsed.flags["--contract-profile"]);
2823
+ const validationPolicyRef = requireFlagValue("--validation-policy-ref", parsed.flags["--validation-policy-ref"]);
2824
+ const evidencePolicyRef = requireFlagValue("--evidence-policy-ref", parsed.flags["--evidence-policy-ref"]);
2825
+ const receiptKind = requireFlagValue("--receipt-kind", parsed.flags["--receipt-kind"]);
2826
+ const redactionClass = requireFlagValue("--redaction-class", parsed.flags["--redaction-class"]);
2660
2827
  const noCache = parseBooleanFlag("--no-cache", parsed.flags["--no-cache"]);
2661
2828
  const noReindex = parseBooleanFlag("--no-reindex", parsed.flags["--no-reindex"]);
2662
2829
  const runId = requireFlagValue("--run-id", parsed.flags["--run-id"]);
@@ -2686,6 +2853,11 @@ function runCommand(parsed, root, runtime) {
2686
2853
  owners,
2687
2854
  supersedes,
2688
2855
  template,
2856
+ contractProfile,
2857
+ validationPolicyRef,
2858
+ evidencePolicyRef,
2859
+ receiptKind,
2860
+ redactionClass,
2689
2861
  noCache,
2690
2862
  noReindex,
2691
2863
  runId,
@@ -2711,6 +2883,8 @@ function runCommand(parsed, root, runtime) {
2711
2883
  return runBundleSubcommand(parsed, root);
2712
2884
  case "graph":
2713
2885
  return runGraphSubcommand(parsed, root);
2886
+ case "git":
2887
+ return runGitSubcommand(parsed, root);
2714
2888
  case "subgraph":
2715
2889
  return runSubgraphSubcommand(parsed, root);
2716
2890
  case "work":
@@ -2951,8 +3125,9 @@ function runCommand(parsed, root, runtime) {
2951
3125
  const changedOnly = parseBooleanFlag("--changed-only", parsed.flags["--changed-only"]);
2952
3126
  const summary = parseBooleanFlag("--summary", parsed.flags["--summary"]);
2953
3127
  const limit = parseNumberFlag("--limit", parsed.flags["--limit"]);
3128
+ const profile = requireFlagValue("--profile", parsed.flags["--pack-profile"]);
2954
3129
  const json = parseBooleanFlag("--json", parsed.flags["--json"]);
2955
- (0, validate_1.runValidateCommand)({ root, out, jsonOut, quiet, json, changedOnly, summary, limit });
3130
+ (0, validate_1.runValidateCommand)({ root, out, jsonOut, quiet, json, changedOnly, summary, limit, profile });
2956
3131
  return 0;
2957
3132
  }
2958
3133
  case "status": {