@jstn-sdk/ma 0.1.11 → 0.1.13

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.
Files changed (159) hide show
  1. package/.codex/agents/Architect.toml +0 -2
  2. package/.codex/agents/Auditor.toml +0 -2
  3. package/.codex/agents/Builder.toml +0 -2
  4. package/.codex/agents/Flow.toml +0 -2
  5. package/.codex/agents/Sage.toml +0 -2
  6. package/.codex/agents/Vibe.toml +0 -2
  7. package/.codex/hooks.json +14 -13
  8. package/.codex/prompts/enforcement.md +4 -0
  9. package/.codex/prompts/skill-contract.md +4 -0
  10. package/COVERAGE.md +211 -0
  11. package/DEMO.md +265 -0
  12. package/README.md +287 -37
  13. package/bin/ma.js +232 -71
  14. package/data/clone-data.ledger.json +41 -0
  15. package/data/clone-data.proof.json +50 -0
  16. package/data/clone-data.rvf +37 -0
  17. package/docs/README.md +7 -1
  18. package/docs/getting-started.md +108 -37
  19. package/docs/installed-sdk.md +23 -0
  20. package/docs/mcp-setup.md +65 -1
  21. package/docs/onboarding.md +18 -2
  22. package/docs/prompt-guidance-contract.md +17 -0
  23. package/docs/prompt-guidance-fragments/active-autonomy-core.md +7 -0
  24. package/docs/qa/release-issue-gates-0.1.13.json +644 -0
  25. package/docs/qa/release-readiness-0.1.13.md +116 -0
  26. package/docs/qa/release-readiness-0.1.5.md +1 -1
  27. package/docs/reference/native-engineering-patterns.md +35 -0
  28. package/docs/reference/native-security-playbooks.md +27 -0
  29. package/docs/reference/native-source-selection.md +27 -0
  30. package/docs/reference/native-style-and-deslop.md +20 -0
  31. package/docs/release-spec.md +37 -10
  32. package/docs/skills-publishing.md +25 -1
  33. package/docs/skills.md +37 -12
  34. package/index.js +222 -2
  35. package/mcp/collections.json +23 -6
  36. package/mcp/local/code-intel.js +113 -0
  37. package/mcp/local/memory.js +46 -0
  38. package/mcp/local/playbooks.js +168 -0
  39. package/mcp/local/state.js +71 -0
  40. package/mcp/local/team-run.js +113 -0
  41. package/mcp/local/trace.js +60 -0
  42. package/mcp/local-capabilities.json +56 -0
  43. package/mcp/native-playbooks.json +117 -0
  44. package/mcp/servers.json +34 -0
  45. package/package.json +8 -2
  46. package/plugins/meta-architect/.app.json +1 -1
  47. package/plugins/meta-architect/.codex-plugin/plugin.json +4 -4
  48. package/plugins/meta-architect/.mcp.json +1 -1
  49. package/plugins/meta-architect/README.md +34 -1
  50. package/plugins/meta-architect/obsidian/main.js +401 -0
  51. package/plugins/meta-architect/obsidian/manifest.json +9 -0
  52. package/plugins/meta-architect/obsidian/styles.css +7 -0
  53. package/plugins/meta-architect/skills/align/SKILL.md +24 -0
  54. package/plugins/meta-architect/skills/align/agents/openai.yaml +4 -0
  55. package/plugins/meta-architect/skills/align/references/shared-language.md +24 -0
  56. package/plugins/meta-architect/skills/arch/SKILL.md +2 -0
  57. package/plugins/meta-architect/skills/build/SKILL.md +3 -0
  58. package/plugins/meta-architect/skills/cleanup/SKILL.md +23 -0
  59. package/plugins/meta-architect/skills/cleanup/agents/openai.yaml +4 -0
  60. package/plugins/meta-architect/skills/cleanup/references/style-and-deslop.md +18 -0
  61. package/plugins/meta-architect/skills/diagnose/SKILL.md +24 -0
  62. package/plugins/meta-architect/skills/diagnose/agents/openai.yaml +4 -0
  63. package/plugins/meta-architect/skills/flow/SKILL.md +2 -0
  64. package/plugins/meta-architect/skills/maestro/SKILL.md +36 -3
  65. package/plugins/meta-architect/skills/maestro/agents/openai.yaml +2 -2
  66. package/plugins/meta-architect/skills/maestro/references/native-ingest-map.md +44 -0
  67. package/plugins/meta-architect/skills/sage/SKILL.md +5 -1
  68. package/plugins/meta-architect/skills/sage/references/source-selection.md +36 -0
  69. package/plugins/meta-architect/skills/tdd/SKILL.md +24 -0
  70. package/plugins/meta-architect/skills/tdd/agents/openai.yaml +4 -0
  71. package/plugins/meta-architect/skills/vet/SKILL.md +5 -1
  72. package/plugins/meta-architect/skills/vet/references/security-playbooks.md +30 -0
  73. package/plugins/meta-architect/skills/vibe/SKILL.md +2 -0
  74. package/scripts/active-autonomy-hook.mjs +96 -0
  75. package/scripts/build-linux-packages.mjs +328 -0
  76. package/scripts/doctor.js +36 -4
  77. package/scripts/install.sh +28 -0
  78. package/scripts/linux-package-lib.mjs +40 -0
  79. package/scripts/linux-package-smoke.mjs +103 -0
  80. package/scripts/ralph/prompt.md +35 -0
  81. package/scripts/release-sync.js +13 -6
  82. package/scripts/release-verify.js +166 -1
  83. package/skills/align/SKILL.md +24 -0
  84. package/skills/align/agents/openai.yaml +4 -0
  85. package/skills/align/references/shared-language.md +24 -0
  86. package/skills/arch/SKILL.md +2 -0
  87. package/skills/build/SKILL.md +3 -0
  88. package/skills/cleanup/SKILL.md +23 -0
  89. package/skills/cleanup/agents/openai.yaml +4 -0
  90. package/skills/cleanup/references/style-and-deslop.md +18 -0
  91. package/skills/diagnose/SKILL.md +24 -0
  92. package/skills/diagnose/agents/openai.yaml +4 -0
  93. package/skills/flow/SKILL.md +2 -0
  94. package/skills/index.json +21 -6
  95. package/skills/maestro/SKILL.md +36 -3
  96. package/skills/maestro/agents/openai.yaml +2 -2
  97. package/skills/maestro/references/native-ingest-map.md +44 -0
  98. package/skills/sage/SKILL.md +5 -1
  99. package/skills/sage/references/source-selection.md +36 -0
  100. package/skills/tdd/SKILL.md +24 -0
  101. package/skills/tdd/agents/openai.yaml +4 -0
  102. package/skills/vet/SKILL.md +5 -1
  103. package/skills/vet/references/security-playbooks.md +30 -0
  104. package/skills/vibe/SKILL.md +2 -0
  105. package/src/bootstrap.js +141 -24
  106. package/src/build-gate.js +2 -2
  107. package/src/decision-log.js +12 -9
  108. package/src/launcher.js +4 -0
  109. package/src/mcp-config.js +130 -8
  110. package/src/mcp-live-client.js +289 -3
  111. package/src/paths.js +37 -1
  112. package/src/policy.js +1 -1
  113. package/src/release-issue-gates.js +190 -0
  114. package/src/release-state.js +30 -1
  115. package/src/runtime/active-autonomy-core.js +208 -0
  116. package/src/runtime/alignment-sentinel.js +165 -0
  117. package/src/runtime/architect-review.js +88 -0
  118. package/src/runtime/build-readiness.js +62 -0
  119. package/src/runtime/code-graph-rehearse.js +113 -0
  120. package/src/runtime/context-economy-core.js +276 -0
  121. package/src/runtime/continuity-notes.js +79 -0
  122. package/src/runtime/core-source-ingest.js +379 -0
  123. package/src/runtime/detached-provider.js +74 -0
  124. package/src/runtime/environment-awareness-core.js +460 -0
  125. package/src/runtime/exposure-catalog.js +276 -0
  126. package/src/runtime/guidance-stack.js +42 -0
  127. package/src/runtime/helper-orchestration-core.js +307 -0
  128. package/src/runtime/learning-loop-core.js +238 -0
  129. package/src/runtime/maestro-events.js +18 -0
  130. package/src/runtime/maestro-manager.js +605 -0
  131. package/src/runtime/maestro-state.js +125 -0
  132. package/src/runtime/mcp-policy.js +192 -0
  133. package/src/runtime/obsidian-integration-core.js +851 -0
  134. package/src/runtime/obsidian-plugin-bridge.js +739 -0
  135. package/src/runtime/orchestrator.js +158 -0
  136. package/src/runtime/prompt-strategy-core.js +230 -0
  137. package/src/runtime/quorum-review.js +90 -0
  138. package/src/runtime/ralph-execution-core.js +217 -0
  139. package/src/runtime/redaction-gateway.js +174 -0
  140. package/src/runtime/runtime-state.js +1223 -0
  141. package/src/runtime/semantic-recording-core.js +147 -0
  142. package/src/runtime/signal-hooks.js +67 -0
  143. package/src/runtime/skills-registry-export.js +670 -0
  144. package/src/runtime/startup-path.js +14 -0
  145. package/src/runtime/universal-plugin-broker-core.js +575 -0
  146. package/src/runtime/workspace-intelligence-runtime.js +674 -0
  147. package/src/runtime/workspace-virtualizer.js +102 -0
  148. package/src/runtime/workspaces.js +25 -0
  149. package/src/runtime-artifacts.js +407 -84
  150. package/src/skill-installer.js +53 -5
  151. package/src/skills.js +1454 -78
  152. package/src/state-sync.js +51 -8
  153. package/docs/qa/release-readiness-0.1.11.md +0 -79
  154. package/plugins/meta-architect/skills/meta-architect/SKILL.md +0 -32
  155. package/plugins/meta-architect/skills/meta-architect/agents/openai.yaml +0 -4
  156. package/skills/meta-architect/SKILL.md +0 -32
  157. package/skills/meta-architect/agents/openai.yaml +0 -4
  158. /package/plugins/meta-architect/skills/{meta-architect → maestro}/references/core-release-rules.md +0 -0
  159. /package/skills/{meta-architect → maestro}/references/core-release-rules.md +0 -0
@@ -0,0 +1,238 @@
1
+ import { ensureDir, readJson, writeFileIfMissing } from "../fs-utils.js";
2
+ import { getRuntimeSubsystemPath } from "../paths.js";
3
+
4
+ export const learningLoopCoreSchemaVersion = "0.1.0";
5
+
6
+ export const learningLoopDomains = [
7
+ "core_orchestration",
8
+ "memory_knowledge",
9
+ "intelligence_learning",
10
+ "code_quality_testing",
11
+ "security_compliance",
12
+ "architecture_methodology",
13
+ "devops_observability",
14
+ "extensibility",
15
+ "domain_specific",
16
+ ];
17
+
18
+ export function getLearningLoopCorePath() {
19
+ return getRuntimeSubsystemPath("context", "learning-loop-core.json");
20
+ }
21
+
22
+ export function createDefaultLearningLoopCore() {
23
+ return {
24
+ schemaVersion: learningLoopCoreSchemaVersion,
25
+ product: "Meta-Architect",
26
+ purpose:
27
+ "First-party learning loop that turns verified workspace outcomes into durable, lane-aware improvements over time.",
28
+ loop: {
29
+ cadence: "every_verified_workflow_or_release_gate",
30
+ sequence: [
31
+ "observe_runtime_outcome",
32
+ "classify_learning_domain",
33
+ "record_semantic_receipt",
34
+ "promote_verified_learning",
35
+ "apply_to_next_run",
36
+ "verify_effectiveness_delta",
37
+ ],
38
+ fail_closed_rule:
39
+ "Unverified observations stay as candidate learnings and must not change gates, release state, or durable policy.",
40
+ },
41
+ domains: [
42
+ {
43
+ id: "core_orchestration",
44
+ label: "Core & Orchestration",
45
+ learns_from: ["maestro_runs", "lane_handoffs", "manager_events"],
46
+ writes_to: [".ma/state/manager-runs.json", ".ma/context/workspace-effectiveness.json"],
47
+ promotion_gate: "handoff_replay_or_release_check_passed",
48
+ },
49
+ {
50
+ id: "memory_knowledge",
51
+ label: "Memory & Knowledge",
52
+ learns_from: ["memory_notes", "obsidian_vault_context", "semantic_receipts"],
53
+ writes_to: [".ma/memory/notes.md", ".ma/memory/index.json", ".ma/context/project.md"],
54
+ promotion_gate: "source_provenance_and_authority_boundary_verified",
55
+ },
56
+ {
57
+ id: "intelligence_learning",
58
+ label: "Intelligence & Learning",
59
+ learns_from: ["prompt_strategy_results", "context_budget_outcomes", "rehearsal_traces"],
60
+ writes_to: [".ma/context/prompt-strategy-core.json", ".ma/context/learning-loop-core.json"],
61
+ promotion_gate: "strategy_result_has_verification_delta",
62
+ },
63
+ {
64
+ id: "code_quality_testing",
65
+ label: "Code Quality & Testing",
66
+ learns_from: ["test_failures", "lint_results", "build_results", "ralph_progress"],
67
+ writes_to: [".ma/specs/logic.md", ".ma/plans/build.md"],
68
+ promotion_gate: "fresh_test_or_build_evidence_passed",
69
+ },
70
+ {
71
+ id: "security_compliance",
72
+ label: "Security & Compliance",
73
+ learns_from: ["vet_findings", "exposure_catalog", "redaction_receipts"],
74
+ writes_to: [".ma/specs/security.md", ".ma/evidence/audits.json"],
75
+ promotion_gate: "security_review_passed_or_blocker_preserved",
76
+ },
77
+ {
78
+ id: "architecture_methodology",
79
+ label: "Architecture & Methodology",
80
+ learns_from: ["architecture_decisions", "methodology_reviews", "tradeoff_outcomes"],
81
+ writes_to: [".ma/specs/architecture.md", ".ma/decisions.json"],
82
+ promotion_gate: "architecture_review_accepts_reusable_pattern",
83
+ },
84
+ {
85
+ id: "devops_observability",
86
+ label: "DevOps & Observability",
87
+ learns_from: ["release_checks", "package_smokes", "runtime_traces", "hook_audits"],
88
+ writes_to: [".ma/runbook.md", ".ma/logs/", ".ma/hooks/audit.log"],
89
+ promotion_gate: "release_or_smoke_gate_passed",
90
+ },
91
+ {
92
+ id: "extensibility",
93
+ label: "Extensibility",
94
+ learns_from: ["skill_exports", "plugin_installs", "mcp_policy_results", "host_payloads"],
95
+ writes_to: [".ma/context/skills-registry-export.json", "mcp/servers.json"],
96
+ promotion_gate: "compatibility_matrix_verified",
97
+ },
98
+ {
99
+ id: "domain_specific",
100
+ label: "Domain-Specific",
101
+ learns_from: ["workspace_stack", "project_domain_notes", "trusted_sources"],
102
+ writes_to: [
103
+ ".ma/context/workspace-context-pack.json",
104
+ ".ma/evidence/semantic-receipts.json",
105
+ ],
106
+ promotion_gate: "domain_claim_has_source_or_user_authority",
107
+ },
108
+ ],
109
+ learning_record_schema: {
110
+ domain: "one_of_learningLoopDomains",
111
+ claim: "string",
112
+ source: "path_or_runtime_surface",
113
+ evidence: ["path_or_command_or_receipt"],
114
+ status: "candidate | verified | rejected | superseded",
115
+ applies_to: ["agent_or_role_or_lane"],
116
+ cannot_mutate: ["release_state_without_owning_lane", "source_evidence", "security_boundary"],
117
+ next_verification: "string",
118
+ },
119
+ hard_rules: [
120
+ "Learning records require domain, claim, source, evidence, status, applies_to, and next_verification.",
121
+ "Candidate learnings can inform context but cannot mutate gates, release state, or durable policy.",
122
+ "Verified learnings must preserve lane authority and semantic channel boundaries.",
123
+ "Obsidian and memory context can inform planning but do not become build evidence without owning-lane promotion.",
124
+ "Security, compliance, redaction, and irreversible-action warnings must not be compressed or auto-promoted.",
125
+ ],
126
+ records: [],
127
+ };
128
+ }
129
+
130
+ export function validateLearningLoopCore(value) {
131
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
132
+ throw new Error("learning loop core must be an object");
133
+ }
134
+ if (value.schemaVersion !== learningLoopCoreSchemaVersion) {
135
+ throw new Error(`Unsupported learning loop core schemaVersion: ${value.schemaVersion}`);
136
+ }
137
+ if (!Array.isArray(value.domains) || value.domains.length !== learningLoopDomains.length) {
138
+ throw new Error("learning loop core must include every required learning domain");
139
+ }
140
+ const ids = new Set(value.domains.map((domain) => domain.id));
141
+ for (const required of learningLoopDomains) {
142
+ if (!ids.has(required)) {
143
+ throw new Error(`learning loop core missing domain: ${required}`);
144
+ }
145
+ }
146
+ for (const domain of value.domains) {
147
+ if (
148
+ typeof domain.label !== "string" ||
149
+ !Array.isArray(domain.learns_from) ||
150
+ !Array.isArray(domain.writes_to) ||
151
+ typeof domain.promotion_gate !== "string"
152
+ ) {
153
+ throw new Error(
154
+ "learning loop domains require label, learns_from, writes_to, and promotion_gate",
155
+ );
156
+ }
157
+ }
158
+ if (!Array.isArray(value.records)) {
159
+ throw new Error("learning loop core requires records array");
160
+ }
161
+ if (JSON.stringify(value).includes(".omx")) {
162
+ throw new Error("learning loop core must not expose OMX runtime paths");
163
+ }
164
+ return value;
165
+ }
166
+
167
+ export function createLearningRecord({
168
+ domain,
169
+ claim,
170
+ source,
171
+ evidence = [],
172
+ status = "candidate",
173
+ appliesTo = ["all_applicable_agents", "all_applicable_roles"],
174
+ nextVerification,
175
+ }) {
176
+ if (!learningLoopDomains.includes(domain)) {
177
+ throw new Error(`Unsupported learning domain: ${domain}`);
178
+ }
179
+ if (!claim || !source || !nextVerification) {
180
+ throw new Error("Learning record requires domain, claim, source, and nextVerification");
181
+ }
182
+ return {
183
+ domain,
184
+ claim,
185
+ source,
186
+ evidence: evidence.filter((entry) => typeof entry === "string" && entry.trim()),
187
+ status,
188
+ applies_to: appliesTo.filter((entry) => typeof entry === "string" && entry.trim()),
189
+ cannot_mutate: ["release_state_without_owning_lane", "source_evidence", "security_boundary"],
190
+ next_verification: nextVerification,
191
+ created_at: new Date().toISOString(),
192
+ };
193
+ }
194
+
195
+ export function addLearningRecord(core, record) {
196
+ const validated = validateLearningLoopCore(core);
197
+ if (!learningLoopDomains.includes(record.domain)) {
198
+ throw new Error(`Unsupported learning domain: ${record.domain}`);
199
+ }
200
+ if (!["candidate", "verified", "rejected", "superseded"].includes(record.status)) {
201
+ throw new Error(`Unsupported learning record status: ${record.status}`);
202
+ }
203
+ return validateLearningLoopCore({
204
+ ...validated,
205
+ records: [...validated.records, record],
206
+ });
207
+ }
208
+
209
+ export function evaluateLearningLoopReadiness(core) {
210
+ const validated = validateLearningLoopCore(core);
211
+ const coveredDomains = new Set(validated.domains.map((domain) => domain.id));
212
+ const verifiedDomains = new Set(
213
+ validated.records
214
+ .filter((record) => record.status === "verified")
215
+ .map((record) => record.domain),
216
+ );
217
+
218
+ return {
219
+ record_type: "learning_loop_readiness",
220
+ ready: learningLoopDomains.every((domain) => coveredDomains.has(domain)),
221
+ domains: learningLoopDomains.length,
222
+ verified_domains: verifiedDomains.size,
223
+ candidate_records: validated.records.filter((record) => record.status === "candidate").length,
224
+ promotion_rule: validated.loop.fail_closed_rule,
225
+ };
226
+ }
227
+
228
+ export async function seedLearningLoopCoreArtifacts() {
229
+ await ensureDir(getRuntimeSubsystemPath("context"));
230
+ await writeFileIfMissing(
231
+ getLearningLoopCorePath(),
232
+ `${JSON.stringify(createDefaultLearningLoopCore(), null, 2)}\n`,
233
+ );
234
+ }
235
+
236
+ export async function loadLearningLoopCore() {
237
+ return validateLearningLoopCore(await readJson(getLearningLoopCorePath()));
238
+ }
@@ -0,0 +1,18 @@
1
+ import fs from "node:fs/promises";
2
+ import { getRuntimeSubsystemPath } from "../paths.js";
3
+
4
+ export function getMaestroEventsPath() {
5
+ return getRuntimeSubsystemPath("logs", "maestro-events.ndjson");
6
+ }
7
+
8
+ export async function appendMaestroEvent(record) {
9
+ const event = {
10
+ schemaVersion: "0.1.0",
11
+ timestamp: new Date().toISOString(),
12
+ ...record,
13
+ };
14
+ const target = getMaestroEventsPath();
15
+ await fs.mkdir(getRuntimeSubsystemPath("logs"), { recursive: true });
16
+ await fs.appendFile(target, `${JSON.stringify(event)}\n`, "utf8");
17
+ return event;
18
+ }