@chrisdudek/yg 2.0.0 → 2.1.0

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.
@@ -11,14 +11,25 @@
11
11
  // prettier-ignore
12
12
  const CORE_PROTOCOL = `## CORE PROTOCOL
13
13
 
14
- Yggdrasil is persistent semantic memory stored in \`.yggdrasil/\`. It maps the repository and provides deterministic implementation context for every node. This document is your complete operating manual. Follow it strictly.
14
+ <EXTREMELY-IMPORTANT>
15
+ This is your operating manual for working in a Yggdrasil-managed repository. Every rule below is mandatory — no skill, plan, workflow, or instruction overrides these requirements.
16
+
17
+ BEFORE working with ANY source file, you MUST run \`yg owner\` to check if it is mapped. If mapped, you MUST use the graph before reading source. YOU DO NOT HAVE A CHOICE.
18
+
19
+ This is not negotiable. This is not optional. You cannot rationalize your way out of this.
20
+ </EXTREMELY-IMPORTANT>
21
+
22
+ Yggdrasil is persistent semantic memory stored in \`.yggdrasil/\`. It maps the repository and provides deterministic implementation context for every node.
15
23
 
16
24
  ### Quick Start Protocol
17
25
 
18
26
  \`\`\`
19
27
  BEFORE reading, researching, planning, OR modifying ANY mapped file:
20
28
  1. yg owner --file <path>
21
- 2. yg build-context --node <owner>
29
+ 2. Choose the right graph tool for your task:
30
+ - Understanding how/why it works → yg build-context --node <owner>
31
+ - Assessing what is affected by a change → yg impact --node <owner>
32
+ - Planning modifications → both (build-context first, then impact)
22
33
  The context package is your primary source of ARCHITECTURAL understanding:
23
34
  intent, constraints, relations, rationale. For IMPLEMENTATION precision
24
35
  (exact behavior, error handling, await patterns, edge cases) — verify
@@ -38,6 +49,8 @@ NEVER: modify code without graph coverage.
38
49
  NEVER: read mapped source files to understand a component without
39
50
  running yg build-context first — the graph captures intent,
40
51
  constraints, and relations that source files cannot.
52
+ NEVER: assess blast radius of a change without running yg impact first
53
+ — the graph knows the dependency structure that grep cannot infer.
41
54
  NEVER: invent rationale, business rules, or decisions.
42
55
  NEVER: auto-resolve drift without asking the user.
43
56
  WHEN UNSURE: ask the user. Never guess. Never assume.
@@ -45,7 +58,7 @@ WHEN UNSURE: ask the user. Never guess. Never assume.
45
58
 
46
59
  ### Five Core Rules
47
60
 
48
- 1. **Graph first.** Before reading, researching, planning, or modifying mapped files, run \`yg owner\` and \`yg build-context\`. Always. The context package is your primary source of architectural understanding. For implementation-level precision (exact behavior, error paths, edge cases) — verify against source code after loading the context package.
61
+ 1. **Graph first.** Before reading, researching, planning, or modifying mapped files, run \`yg owner\` and the appropriate graph tool: \`yg build-context\` to understand a component, \`yg impact\` to assess blast radius. The graph is your primary source of architectural understanding. For implementation-level precision (exact behavior, error paths, edge cases) — verify against source code after loading the context package.
49
62
  2. **Code and graph are one.** Code changed → graph updated in the same response. Graph changed → source verified in the same response. No exceptions.
50
63
  3. **Never invent why.** The graph captures human intent. If you don't know why something was decided, ask. Never hallucinate rationale.
51
64
  4. **Always capture why — especially why NOT.** When the user explains a reason, record it in the graph immediately. When a design choice is made, also record rejected alternatives: "Chose X over Y because Z." Rejected alternatives are the highest-value information — invisible in code and irrecoverable once forgotten. Conversation evaporates; graph persists.
@@ -53,15 +66,22 @@ WHEN UNSURE: ask the user. Never guess. Never assume.
53
66
 
54
67
  ### Recognizing Graph-Required Actions
55
68
 
56
- What matters is the ACTION you are performing, not what instructed it. If the action involves understanding mapped code, the graph protocol applies — whether the instruction came from a skill, a plan, a user message, a workflow step, or your own initiative.
69
+ What matters is the ACTION you are performing, not what instructed it. If the action involves reading, understanding, or modifying mapped code, the graph protocol applies — whether the instruction came from a skill, a plan, a user message, a brainstorming session, a debugging workflow, or your own initiative. This is not negotiable. You cannot rationalize your way out of this.
57
70
 
58
- **Actions that require \`yg owner\` + \`yg build-context\` first:**
71
+ **Actions that require \`yg owner\` + \`yg build-context\`:**
59
72
 
60
73
  - Reading or exploring source files to understand a component
61
74
  - Proposing approaches, designs, or plans for changing code
62
75
  - Reviewing or debugging code
63
76
  - Any form of reasoning about how mapped code works or should change
64
77
 
78
+ **Actions that require \`yg owner\` + \`yg impact\`:**
79
+
80
+ - Assessing blast radius before changing or removing a component
81
+ - Finding all dependents of a component
82
+ - Planning cross-cutting refactors or feature removals
83
+ - Scoping work that spans multiple nodes
84
+
65
85
  **Actions that do NOT require yg:**
66
86
 
67
87
  - Git operations (log, diff, status, blame)
@@ -69,11 +89,22 @@ What matters is the ACTION you are performing, not what instructed it. If the ac
69
89
  - Running tests, builds, or linters
70
90
  - Working with files that \`yg owner\` reports as unmapped
71
91
 
92
+ **Evasion patterns — if you think any of these, STOP:**
93
+
94
+ | Thought | Reality |
95
+ |---|---|
96
+ | "The skill/plan says to explore the codebase" | Exploring mapped code = yg owner + graph tool first |
97
+ | "I'm just scoping/searching, not understanding" | Scoping IS a graph action; use yg impact |
98
+ | "The plan step says to read this file" | Reading a mapped file = yg owner first |
99
+ | "I'm brainstorming, not implementing" | Brainstorming about mapped code needs graph context |
100
+ | "I'm only grepping for references" | Grep finds text; yg impact finds structural dependencies. Use both. |
101
+ | "I'll use the graph later when I modify" | Graph-first means BEFORE reading, not before modifying |
102
+
72
103
  ### Failure States
73
104
 
74
105
  You have broken Yggdrasil if you do any of the following:
75
106
 
76
- - ❌ Worked on a mapped file without running \`yg owner\` + \`yg build-context\` first — regardless of what instructed the action (skill, plan, user request, workflow step).
107
+ - ❌ Worked on a mapped file without running \`yg owner\` + the appropriate graph tool (\`build-context\` or \`impact\`) first — regardless of what instructed the action (skill, plan, user request, workflow step).
77
108
  - ❌ Modified source code without updating graph artifacts in the same response, or vice versa.
78
109
  - ❌ Resolved a code-graph inconsistency or ambiguity without asking the user first.
79
110
  - ❌ Created or edited a graph element without reading its schema in \`schemas/\` first.
@@ -120,9 +151,8 @@ const OPERATIONS = `## OPERATIONS
120
151
  \`\`\`
121
152
  PREFLIGHT (every conversation, before any work):
122
153
  - [ ] 1. yg preflight → read unified report
123
- - [ ] 2. If journal entries: consolidate to graph, then yg journal-archive
124
- - [ ] 3. If drift: resolve per Drift Resolution, then yg drift-sync per node
125
- - [ ] 4. If validation errors: fix, re-run yg validate
154
+ - [ ] 2. If drift: resolve per Drift Resolution, then yg drift-sync per node
155
+ - [ ] 3. If validation errors: fix, re-run yg validate
126
156
  Exception: read-only requests (explain, analyze) — skip preflight.
127
157
 
128
158
  UNDERSTANDING mapped code (questions, research, OR planning):
@@ -133,14 +163,14 @@ UNDERSTANDING mapped code (questions, research, OR planning):
133
163
  Raw reads supplement the context package — they do not replace it.
134
164
 
135
165
  WRAP-UP (user signals "done", "wrap up", "that's enough"):
136
- - [ ] 1. Consolidate journal if used yg journal-archive
137
- - [ ] 2. yg drift --drifted-only resolve
138
- - [ ] 3. yg validate fix errors
139
- - [ ] 4. Report: which nodes and files were changed
166
+ - [ ] 1. yg drift --drifted-onlyresolve
167
+ - [ ] 2. yg validatefix errors
168
+ - [ ] 3. Report: which nodes and files were changed
140
169
 
141
170
  BEFORE ENDING ANY RESPONSE (self-audit):
171
+ - [ ] Did I interact with mapped code (read, research, or modify)? If yes → did I use a graph tool BEFORE reading source?
142
172
  - [ ] Did I modify source code? If yes → did I update graph artifacts in this same response?
143
- - [ ] If you changed code and did not sync the graph, you have broken the protocol. Do not finish until both are done.
173
+ - [ ] If you broke either rule, you have broken the protocol. Do not finish until both are fixed.
144
174
  \`\`\`
145
175
 
146
176
  ### Modify Source Code
@@ -280,8 +310,7 @@ const KNOWLEDGE_BASE = `## KNOWLEDGE BASE
280
310
  aspects/ ← what must: cross-cutting requirements with rationale and guidance
281
311
  flows/ ← why and in what process: business processes with node participation
282
312
  schemas/ ← YAML schemas — read before creating any graph element
283
- .drift-state ← generated by CLI; never edit manually
284
- .journal.yaml ← generated by CLI; never edit manually
313
+ .drift-state/ ← generated by CLI; never edit manually
285
314
  \`\`\`
286
315
 
287
316
  Key facts:
@@ -374,7 +403,7 @@ Test: "Does this describe what happens in the world, or only in the software?" I
374
403
  ### CLI Reference
375
404
 
376
405
  \`\`\`
377
- yg preflight [--quick] Unified diagnostic: journal + drift + status + validate.
406
+ yg preflight [--quick] Unified diagnostic: drift + status + validate.
378
407
  yg owner --file <path> Find the node that owns this file.
379
408
  yg build-context --node <path> Assemble context package for this node.
380
409
  yg tree [--root <path>] [--depth N] Print graph structure.
@@ -392,10 +421,6 @@ yg drift [--scope <path>|all] [--drifted-only] [--limit <n>]
392
421
  Detect source and graph drift (bidirectional).
393
422
  yg drift-sync --node <path> [--recursive] | --all
394
423
  Record file hashes as new baseline.
395
- yg journal-read Read pending journal entries.
396
- yg journal-add --note "<content>" [--target <node_path>]
397
- Add a journal entry.
398
- yg journal-archive Archive consolidated journal entries.
399
424
  \`\`\`
400
425
 
401
426
  ### Quick Routing Table
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrisdudek/yg",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Make your repository self-aware. Persistent semantic memory and deterministic context assembly for AI agents.",
5
5
  "type": "module",
6
6
  "bin": {