@chrisdudek/yg 0.2.0 → 0.2.1

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/dist/bin.js CHANGED
@@ -83,6 +83,8 @@ var AGENT_RULES_CONTENT = `# Yggdrasil - System Semantic Memory (Operating Manua
83
83
  You are working in a repository managed by Yggdrasil.
84
84
  Yggdrasil is a persistent, structured semantic memory graph stored in \`.yggdrasil/\`. It maps the repository, dictates system rules, and assembles implementation contexts.
85
85
 
86
+ **Why:** AI agents degrade with project size \u2014 too little context breaks contracts, too much context drowns in noise. The graph is persistent semantic memory: agents need exactly the right tokens for the task, not the whole repo. Small, precise context beats massive noisy. A repository with Yggdrasil is self-aware.
87
+
86
88
  THIS PROMPT IS YOUR ENTIRE OPERATING MANUAL. Read it carefully. Follow it strictly.
87
89
 
88
90
  ---
@@ -106,13 +108,14 @@ THIS PROMPT IS YOUR ENTIRE OPERATING MANUAL. Read it carefully. Follow it strict
106
108
  5. **Tools Read, You Write:** The \`yg\` CLI tools only read, validate, and manage metadata. YOU must create and edit graph directories, \`.yaml\` files, and \`.md\` artifacts manually.
107
109
  6. **English Only for Artifacts:** All graph artifact files (filenames from \`config.artifacts\`, in the same directory as \`node.yaml\`) MUST be written in English. Conversation can be in the user's language.
108
110
  7. **Never Touch Operational Metadata:** NEVER manually edit \`.yggdrasil/.drift-state\` or \`.yggdrasil/.journal.yaml\`.
109
- 8. **Ask, Never Infer:** If graph and code diverge in a way with multiple valid resolutions, or if a required decision is ambiguous \u2014 STOP. State the ambiguity. List interpretations. Ask the user to decide. Never silently choose. Never patch without confirmation.
111
+ 8. **Ask, Never Infer:** If graph and code diverge in a way with multiple valid resolutions, or if a required decision is ambiguous \u2014 STOP. State the ambiguity. List interpretations. Ask the user to decide. Never silently choose. Never patch without confirmation. When you stop, always explain the context and available options clearly so the user can make an informed choice.
110
112
 
111
113
  ---
112
114
 
113
115
  ## 1.5 FAILURE STATES
114
116
 
115
117
  You have fundamentally broken Yggdrasil if you do any of the following:
118
+ - \u274C You modified source code without having run \`yg owner --file <path>\` for each modified file in the SAME response.
116
119
  - \u274C You modified source code without updating graph artifacts in the SAME response.
117
120
  - \u274C You modified graph files without verifying/updating source code alignment in the SAME response.
118
121
  - \u274C You resolved a code\u2194graph inconsistency without asking the user first.
@@ -128,7 +131,7 @@ You have fundamentally broken Yggdrasil if you do any of the following:
128
131
  You do not need explicit "session" commands. Follow these conversational triggers:
129
132
 
130
133
  ### A. Preflight (First message of the conversation)
131
- Always execute these commands before doing anything else. *(Exception: If the user's request is clearly read-only, like "explain this", run ONLY step 1).*
134
+ Always execute these commands before doing anything else. *(Exception: If the user's request is clearly read-only, run ONLY step 1).* **Read-only** means the user asks only for explanation, clarification, analysis, or evaluation \u2014 no code or graph modification will occur. Examples: "explain this", "evaluate X", "what does Y do?", "analyze Z". If unsure, run full preflight.
132
135
  1. \`yg journal-read\` -> If entries exist, consolidate them into the graph, then \`yg journal-archive\`.
133
136
  2. \`yg drift\` -> If divergence is detected, present states (\`ok\`, \`drift\`, \`missing\`, \`unmaterialized\`). Ask the user: Absorb (update graph) or Reject (re-materialize code from graph)?
134
137
  3. \`yg status\` -> Report graph health.
@@ -148,6 +151,8 @@ Triggered by phrases like: "we're done", "wrap up", "that's enough", "done".
148
151
 
149
152
  You are NOT ALLOWED to edit or create source code without establishing graph coverage first.
150
153
 
154
+ **Gate:** Before using any tool that modifies files, you MUST have run \`yg owner --file <path>\` for each file you intend to modify. If you have not \u2014 run it first, then proceed. No exceptions. Gate applies to **source files** (files outside \`.yggdrasil/\`). For graph files (\`.yggdrasil/model/\`, \`.yggdrasil/aspects/\`, etc.), follow the Graph Modification Checklist in section 4 instead.
155
+
151
156
  **Step 1: Check coverage** -> Run \`yg owner --file <path>\`
152
157
 
153
158
  **Step 2: If Owner FOUND (The Execution Checklist)**
@@ -227,11 +232,11 @@ Your ultimate goal when describing a file or node is **Context Reproducibility**
227
232
  However, you must NOT dump all knowledge into a single file. Yggdrasil's context package is **multi-layered** and hierarchically assembled. When you map existing code or design new code, you must deconstruct the knowledge and place it at the correct abstraction layer so the engine can mechanically reassemble it.
228
233
 
229
234
  ### CRITICAL RULE: CAPTURE INTENT, BUT NEVER INVENT IT
230
- The graph is not just a structural map; it is the semantic meaning of the system. Code explains "what" and "how". The graph MUST explain "WHY".
235
+ The graph is not just a structural map; it is the semantic meaning of the system. Code explains "what" and "how". The graph MUST explain "WHY".
231
236
 
232
237
  1. **ALWAYS Capture the User's "Why":** If the user explains the business reason, intent, or rationale behind a request (e.g., "We need to do X because Y"), you MUST permanently record this reasoning in the relevant graph artifacts (e.g., \`responsibility.md\`, \`constraints.md\`, \`decisions.md\`). Do not let the conversation context evaporate.
233
- 2. **NEVER Invent the "Why":** Files that imply human judgment (like \`decisions.md\` or \`knowledge/invariants\`) must reflect ACTUAL human choices.
234
- 3. **NO Hallucinations:** You MUST NEVER infer or hallucinate a rationale, an architectural decision, or a business rule.
238
+ 2. **NEVER Invent the "Why":** Files that imply human judgment (like \`decisions.md\` or \`knowledge/invariants\`) must reflect ACTUAL human choices.
239
+ 3. **NO Hallucinations:** You MUST NEVER infer or hallucinate a rationale, an architectural decision, or a business rule.
235
240
  4. **Ask if Missing:** If the user requests a significant architectural or business logic change but does not provide the rationale, you MUST ask them "Why are we making this change?" before documenting the decision in the graph.
236
241
 
237
242
  When mapping a file, execute this mental routing:
@@ -265,7 +270,7 @@ When mapping a file, execute this mental routing:
265
270
  * If the file reveals an undocumented global invariant or decision: Ask the user to confirm it. If confirmed, create it under \`.yggdrasil/knowledge/<category>/\` so all future nodes inherit it.
266
271
 
267
272
  **THE COMPLETENESS CHECK:**
268
- Before finishing a mapping, ask yourself: *"If I delete the source file and give another agent ONLY the output of \`yg build-context\`, can they recreate it perfectly based on the configured artifacts, AND will they understand EXACTLY WHY this code exists and why it was designed this way?"*
273
+ Before finishing a mapping, ask yourself: *"If I delete the source file and give another agent ONLY the output of \`yg build-context\`, can they recreate it perfectly based on the configured artifacts, AND will they understand EXACTLY WHY this code exists and why it was designed this way?"*
269
274
  - If no -> You missed a local constraint, a relation, or you failed to capture the user's provided rationale.
270
275
  - If yes, but the local files are bloated -> You failed to deconstruct knowledge into Tags, Aspects, Flows, and Hierarchy. Fix the routing.
271
276