tycono 0.3.45-beta.2 → 0.3.45-beta.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.
Files changed (113) hide show
  1. package/README.md +191 -162
  2. package/bin/tycono.ts +42 -10
  3. package/package.json +21 -15
  4. package/packages/server/bin/cli.js +35 -0
  5. package/packages/server/bin/server.ts +183 -0
  6. package/{src → packages/server/src}/api/src/create-server.ts +11 -3
  7. package/{src → packages/server/src}/api/src/engine/agent-loop.ts +30 -7
  8. package/{src → packages/server/src}/api/src/engine/context-assembler.ts +122 -57
  9. package/{src → packages/server/src}/api/src/engine/llm-adapter.ts +10 -7
  10. package/{src → packages/server/src}/api/src/engine/org-tree.ts +43 -3
  11. package/{src → packages/server/src}/api/src/engine/runners/claude-cli.ts +37 -15
  12. package/{src → packages/server/src}/api/src/engine/runners/types.ts +6 -0
  13. package/{src → packages/server/src}/api/src/engine/tools/executor.ts +65 -9
  14. package/{src → packages/server/src}/api/src/routes/execute.ts +221 -17
  15. package/packages/server/src/api/src/services/claude-md-manager.ts +190 -0
  16. package/{src → packages/server/src}/api/src/services/company-config.ts +1 -0
  17. package/{src → packages/server/src}/api/src/services/digest-engine.ts +4 -1
  18. package/packages/server/src/api/src/services/dispatch-classifier.ts +179 -0
  19. package/{src → packages/server/src}/api/src/services/execution-manager.ts +227 -21
  20. package/{src → packages/server/src}/api/src/services/file-reader.ts +4 -1
  21. package/packages/server/src/api/src/services/preset-loader.ts +310 -0
  22. package/{src → packages/server/src}/api/src/services/supervisor-heartbeat.ts +89 -9
  23. package/{src → packages/server/src}/api/src/services/wave-multiplexer.ts +18 -8
  24. package/{src → packages/server/src}/api/src/services/wave-tracker.ts +25 -0
  25. package/packages/server/src/core/scaffolder.ts +620 -0
  26. package/{src → packages/server/src}/shared/types.ts +3 -1
  27. package/packages/server/templates/CLAUDE.md.tmpl +152 -0
  28. package/packages/server/templates/agentic-knowledge-base.md +355 -0
  29. package/src/api/src/services/claude-md-manager.ts +0 -94
  30. package/src/api/src/services/preset-loader.ts +0 -149
  31. package/templates/CLAUDE.md.tmpl +0 -239
  32. /package/{src/web → packages/pixel}/dist/assets/index-BJyiMGkM.js +0 -0
  33. /package/{src/web → packages/pixel}/dist/assets/index-BOuHc64o.css +0 -0
  34. /package/{src/web → packages/pixel}/dist/assets/index-DDPzbp9E.js +0 -0
  35. /package/{src/web → packages/pixel}/dist/assets/index-DVKWFwwK.css +0 -0
  36. /package/{src/web → packages/pixel}/dist/assets/preview-app-DZ6WxhDc.js +0 -0
  37. /package/{src/web → packages/pixel}/dist/index.html +0 -0
  38. /package/{src/web → packages/pixel}/dist/tyconoforge.js +0 -0
  39. /package/{src → packages/server/src}/api/package.json +0 -0
  40. /package/{src → packages/server/src}/api/src/create-app.ts +0 -0
  41. /package/{src → packages/server/src}/api/src/engine/authority-validator.ts +0 -0
  42. /package/{src → packages/server/src}/api/src/engine/index.ts +0 -0
  43. /package/{src → packages/server/src}/api/src/engine/knowledge-gate.ts +0 -0
  44. /package/{src → packages/server/src}/api/src/engine/role-lifecycle.ts +0 -0
  45. /package/{src → packages/server/src}/api/src/engine/runners/direct-api.ts +0 -0
  46. /package/{src → packages/server/src}/api/src/engine/runners/index.ts +0 -0
  47. /package/{src → packages/server/src}/api/src/engine/skill-template.ts +0 -0
  48. /package/{src → packages/server/src}/api/src/engine/tools/definitions.ts +0 -0
  49. /package/{src → packages/server/src}/api/src/routes/active-sessions.ts +0 -0
  50. /package/{src → packages/server/src}/api/src/routes/coins.ts +0 -0
  51. /package/{src → packages/server/src}/api/src/routes/company.ts +0 -0
  52. /package/{src → packages/server/src}/api/src/routes/cost.ts +0 -0
  53. /package/{src → packages/server/src}/api/src/routes/engine.ts +0 -0
  54. /package/{src → packages/server/src}/api/src/routes/git.ts +0 -0
  55. /package/{src → packages/server/src}/api/src/routes/knowledge.ts +0 -0
  56. /package/{src → packages/server/src}/api/src/routes/operations.ts +0 -0
  57. /package/{src → packages/server/src}/api/src/routes/preferences.ts +0 -0
  58. /package/{src → packages/server/src}/api/src/routes/presets.ts +0 -0
  59. /package/{src → packages/server/src}/api/src/routes/projects.ts +0 -0
  60. /package/{src → packages/server/src}/api/src/routes/quests.ts +0 -0
  61. /package/{src → packages/server/src}/api/src/routes/roles.ts +0 -0
  62. /package/{src → packages/server/src}/api/src/routes/save.ts +0 -0
  63. /package/{src → packages/server/src}/api/src/routes/sessions.ts +0 -0
  64. /package/{src → packages/server/src}/api/src/routes/setup.ts +0 -0
  65. /package/{src → packages/server/src}/api/src/routes/skills.ts +0 -0
  66. /package/{src → packages/server/src}/api/src/routes/speech.ts +0 -0
  67. /package/{src → packages/server/src}/api/src/routes/supervision.ts +0 -0
  68. /package/{src → packages/server/src}/api/src/routes/sync.ts +0 -0
  69. /package/{src → packages/server/src}/api/src/server.ts +0 -0
  70. /package/{src → packages/server/src}/api/src/services/activity-stream.ts +0 -0
  71. /package/{src → packages/server/src}/api/src/services/activity-tracker.ts +0 -0
  72. /package/{src → packages/server/src}/api/src/services/database.ts +0 -0
  73. /package/{src → packages/server/src}/api/src/services/git-save.ts +0 -0
  74. /package/{src → packages/server/src}/api/src/services/job-manager.ts +0 -0
  75. /package/{src → packages/server/src}/api/src/services/knowledge-importer.ts +0 -0
  76. /package/{src → packages/server/src}/api/src/services/markdown-parser.ts +0 -0
  77. /package/{src → packages/server/src}/api/src/services/port-registry.ts +0 -0
  78. /package/{src → packages/server/src}/api/src/services/preferences.ts +0 -0
  79. /package/{src → packages/server/src}/api/src/services/pricing.ts +0 -0
  80. /package/{src → packages/server/src}/api/src/services/scaffold.ts +0 -0
  81. /package/{src → packages/server/src}/api/src/services/session-store.ts +0 -0
  82. /package/{src → packages/server/src}/api/src/services/team-recommender.ts +0 -0
  83. /package/{src → packages/server/src}/api/src/services/token-ledger.ts +0 -0
  84. /package/{src → packages/server/src}/api/src/services/wave-messages.ts +0 -0
  85. /package/{src → packages/server/src}/api/src/utils/role-level.ts +0 -0
  86. /package/{templates → packages/server/templates}/company.md.tmpl +0 -0
  87. /package/{templates → packages/server/templates}/gitignore.tmpl +0 -0
  88. /package/{templates → packages/server/templates}/roles.md.tmpl +0 -0
  89. /package/{templates → packages/server/templates}/skills/_manifest.json +0 -0
  90. /package/{templates → packages/server/templates}/skills/agent-browser/SKILL.md +0 -0
  91. /package/{templates → packages/server/templates}/skills/agent-browser/meta.json +0 -0
  92. /package/{templates → packages/server/templates}/skills/akb-linter/SKILL.md +0 -0
  93. /package/{templates → packages/server/templates}/skills/akb-linter/meta.json +0 -0
  94. /package/{templates → packages/server/templates}/skills/knowledge-gate/SKILL.md +0 -0
  95. /package/{templates → packages/server/templates}/skills/knowledge-gate/meta.json +0 -0
  96. /package/{templates → packages/server/templates}/teams/agency.json +0 -0
  97. /package/{templates → packages/server/templates}/teams/research.json +0 -0
  98. /package/{templates → packages/server/templates}/teams/startup.json +0 -0
  99. /package/{src/tui → packages/tui/src}/api.ts +0 -0
  100. /package/{src/tui → packages/tui/src}/app.tsx +0 -0
  101. /package/{src/tui → packages/tui/src}/components/CommandMode.tsx +0 -0
  102. /package/{src/tui → packages/tui/src}/components/OrgTree.tsx +0 -0
  103. /package/{src/tui → packages/tui/src}/components/PanelMode.tsx +0 -0
  104. /package/{src/tui → packages/tui/src}/components/SetupWizard.tsx +0 -0
  105. /package/{src/tui → packages/tui/src}/components/StatusBar.tsx +0 -0
  106. /package/{src/tui → packages/tui/src}/components/StreamView.tsx +0 -0
  107. /package/{src/tui → packages/tui/src}/hooks/useApi.ts +0 -0
  108. /package/{src/tui → packages/tui/src}/hooks/useCommand.ts +0 -0
  109. /package/{src/tui → packages/tui/src}/hooks/useSSE.ts +0 -0
  110. /package/{src/tui → packages/tui/src}/index.tsx +0 -0
  111. /package/{src/tui → packages/tui/src}/store.ts +0 -0
  112. /package/{src/tui → packages/tui/src}/theme.ts +0 -0
  113. /package/{src/tui → packages/tui/src}/utils/markdown.tsx +0 -0
@@ -0,0 +1,152 @@
1
+ # Your Knowledge Base
2
+
3
+ > Powered by [Tycono](https://tycono.ai)
4
+
5
+ ---
6
+
7
+ ## AKB Core Concept
8
+
9
+ > **AKB** = File-based knowledge system where AI finds via **Search (Grep/Glob)** and navigates via **Contextual Links**
10
+
11
+ | Layer | Role | AI Usage |
12
+ |-------|------|----------|
13
+ | **Root** (CLAUDE.md) | Minimal routing | Auto-injected as system prompt |
14
+ | **Hub** ({folder}.md) | Human TOC + guides | **Check before starting work** |
15
+ | **Node** (*.md) | Actual information | Direct search via Grep/Glob |
16
+
17
+ ---
18
+
19
+ ## AI Working Rules (CRITICAL)
20
+
21
+ ### Hub-First Principle
22
+
23
+ > ⛔ **Read Hub document BEFORE implementing/testing**
24
+
25
+ Based on AKB observations, AI tends to skip Hubs and search directly.
26
+ But **Hubs contain existing tools/scripts/guides** - missing them causes redundant work.
27
+
28
+ Every folder has a Hub file (`{folder-name}.md`) as its entry point.
29
+ Read the Hub's existing tools/scripts/guides before starting work.
30
+
31
+ ### Required Check Situations
32
+
33
+ | Situation | Read First | What to Find |
34
+ |-----------|------------|--------------|
35
+ | Debugging/Testing | Hub → guides/ | Existing debug tools |
36
+ | API Calls | Hub → related Node | Documented methods |
37
+ | New Feature | Hub | Similar existing features |
38
+ | Strategy/Design | Hub + detail docs | Design philosophy, past decisions |
39
+
40
+ ### Correct Patterns
41
+
42
+ ```
43
+ ✅ Debugging
44
+ → {domain}.md (Hub) → guides/debugging.md
45
+ → Use existing debug scripts
46
+
47
+ ✅ Testing
48
+ → {domain}.md (Hub) → test utilities
49
+
50
+ ✅ API Integration
51
+ → api.md (Hub) → existing client libraries
52
+ ```
53
+
54
+ ### Anti-Patterns
55
+
56
+ ```
57
+ ❌ Skip Hub → curl API directly
58
+ ❌ Skip Hub → Write scripts from scratch
59
+ ❌ Skip Hub → Start with assumptions
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Exploration Depth Principle
65
+
66
+ > ⛔ **For strategy/idea questions, Hub alone is NOT enough. Explore detail docs.**
67
+
68
+ AI tends to read a few Hubs and judge "sufficient".
69
+ But **strategic questions need specific context** - shallow exploration leads to superficial answers.
70
+
71
+ ### Exploration Depth by Question Type
72
+
73
+ | Question Type | Minimum | Additional |
74
+ |---------------|---------|------------|
75
+ | Implementation | Hub | Related Nodes |
76
+ | Debugging/Testing | Hub → guides/ | Existing tools |
77
+ | **Strategy/Ideas** | Hub | **Design philosophy, core problems, phase docs** |
78
+ | **Connecting A and B** | **Both Hubs** | **Both core docs (design, business, phases)** |
79
+
80
+ ### When Deep Exploration is Needed
81
+
82
+ ```
83
+ ✅ "How to connect System A and System B?"
84
+ → system-a.md + system-b.md (both Hubs)
85
+ → architecture.md (system design)
86
+ → security-model.md (design philosophy)
87
+ → business-requirements.md (business context)
88
+
89
+ ✅ "Ideas for improving performance?"
90
+ → {domain}.md (Hub)
91
+ → performance-analysis.md (problem details, current approach)
92
+
93
+ ✅ "Apply this architecture to another domain?"
94
+ → architecture.md (Hub)
95
+ → design-philosophy.md (domain-independent principles)
96
+ ```
97
+
98
+ ### Risks of Shallow Exploration
99
+
100
+ ```
101
+ ❌ Read only a few Hubs → "sufficient" judgment → superficial ideas
102
+ ❌ List only technical features → No connection to actual problems
103
+ ❌ Deep dive one side only → Forced fitting (bad integration)
104
+ ```
105
+
106
+ > **Domain ≠ Core Problem**
107
+ > Knowing "what the service is" but not "what's the core problem" → Technology pushing happens.
108
+ > AKB Hubs specify core problems, enabling "problem-centered" connections.
109
+
110
+ ---
111
+
112
+ ## Knowledge Gate
113
+
114
+ > **Before creating a new document, search existing docs first.**
115
+
116
+ ```
117
+ 1. Summarize the insight + 3-5 keywords
118
+ 2. Search existing docs with those keywords (grep 3+ terms)
119
+ 3. Decide:
120
+ - Overlap 70%+ -> Add to existing document
121
+ - Overlap 30-70% -> New doc + cross-link to existing
122
+ - Overlap <30% -> New document (register in Hub)
123
+ - Temporary info -> Journal only (no new doc)
124
+ 4. Cross-link to related docs
125
+ 5. Register in the relevant Hub
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Document Hygiene
131
+
132
+ | Rule | Description |
133
+ |------|-------------|
134
+ | No orphan docs | Every document must be reachable from a Hub |
135
+ | Hub pattern | Each folder's entry point is `{folder}.md` |
136
+ | Prefer existing | Adding 1 doc = maintenance cost. Strengthen existing > create new |
137
+ | Cross-link | New docs must reference at least 1 related doc |
138
+ | Source attribution | External research must cite source and date |
139
+
140
+ ---
141
+
142
+ ## Writing Rules (4 Principles)
143
+
144
+ 1. **TL;DR Required**: Include searchable keywords (bold)
145
+ 2. **Contextual Links**: Place links in body text with context
146
+ 3. **Keyword-Optimized Filenames**: `wallet-security.md` not `security.md`
147
+ 4. **Atomicity**: One topic per document, under 200 lines
148
+
149
+ ---
150
+
151
+ <!-- tycono:managed v{{VERSION}} — This file is managed by Tycono. Do not edit manually. -->
152
+ <!-- Company-specific rules go in custom-rules.md (knowledge/ root) -->
@@ -0,0 +1,355 @@
1
+ ---
2
+ title: Agentic Knowledge Base (AKB)
3
+ akb_type: node
4
+ status: active
5
+ tags:
6
+ - type/how-to
7
+ - domain/akb
8
+ ---
9
+
10
+ # Agentic Knowledge Base (AKB)
11
+
12
+ **An autonomous knowledge protocol designed for AI agents**
13
+
14
+ > This is the **Canonical Reference** for AKB.
15
+
16
+ ---
17
+
18
+ ## TL;DR
19
+
20
+ - **Definition**: A file-based knowledge system where AI uses **search (Grep/Glob)** to find and **contextual links** to navigate
21
+ - **Essence**: File-based Lightweight Ontology (Tag = Type, inline links = Edges)
22
+ - **Philosophy**: Optimize documents so AI can find them — don't force AI to follow a rigid protocol
23
+ - **Structure**: Root (CLAUDE.md) → Hub ({folder}.md) → Node (*.md)
24
+ - **Core rules**: 5 writing principles (TL;DR, contextual links, keyword-optimized filenames, atomicity, semantic vs implementation separation)
25
+
26
+ ---
27
+
28
+ ## Definition
29
+
30
+ > "Code is logic machines execute. AKB is context agents think with."
31
+
32
+ AKB is a **file-based connected knowledge system** designed so AI agents can **search**, **learn**, and **retrieve** context without infrastructure (no Vector DB required).
33
+
34
+ ### Core Philosophy
35
+
36
+ > "Don't try to inject everything into AI at once.
37
+ > Instead, give it **documents that are easy to find**."
38
+
39
+ ---
40
+
41
+ ## Essence: File-Based Ontology
42
+
43
+ > "Inject the spirit of Ontology into Markdown"
44
+
45
+ ```
46
+ ┌─────────────────────────────────────────────────────┐
47
+ │ AKB = Lightweight Knowledge Graph │
48
+ ├─────────────────────────────────────────────────────┤
49
+ │ │
50
+ │ Ontology/KG AKB │
51
+ │ ─────────── ─── │
52
+ │ Entity (Node) → .md file │
53
+ │ rdf:type → tags: [type/] │
54
+ │ domain → tags: [domain/] │
55
+ │ rdfs:comment → TL;DR section │
56
+ │ Edge/Relationship → Inline contextual link │
57
+ │ │
58
+ └─────────────────────────────────────────────────────┘
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Architecture
64
+
65
+ AKB follows a 3-layer hierarchy: **[Root] → [Hub] → [Node]**.
66
+
67
+ ```
68
+ project/
69
+ ├── CLAUDE.md # [Root] Minimal routing (key file paths)
70
+
71
+ └── knowledge/
72
+
73
+ ├── domain/ # [Hub] TOC for humans
74
+ │ ├── domain.md # └─ Hub entry point
75
+ │ └── entity-id-system.md # [Node] Concrete knowledge
76
+
77
+ ├── investigation/
78
+ │ ├── investigation.md # [Hub]
79
+ │ ├── autotrace/
80
+ │ │ ├── autotrace.md # [Sub-Hub]
81
+ │ │ ├── fifo-strategy.md # [Node] ← AI finds via search
82
+ │ │ └── execution-flow.md # [Node]
83
+ ```
84
+
85
+ ### Layer Roles
86
+
87
+ | Layer | Role | Description |
88
+ |-------|------|-------------|
89
+ | **Root** (CLAUDE.md) | Minimal routing | Auto-injected as system prompt, provides key file paths |
90
+ | **Hub** ({folder}.md) | TOC for humans | Folder overview; AI reads selectively |
91
+ | **Node** (*.md) | Actual information | What AI searches for via Grep/Glob |
92
+
93
+ ---
94
+
95
+ ## Schema Specification
96
+
97
+ ### Frontmatter
98
+
99
+ ```yaml
100
+ ---
101
+ title: "Document title"
102
+ akb_type: hub|node
103
+ status: active|draft|deprecated
104
+ tags:
105
+ - "type/..." # Document type
106
+ - "domain/..." # Domain classification
107
+ ---
108
+ ```
109
+
110
+ | Field | Type | Purpose |
111
+ |-------|------|---------|
112
+ | `title` | string | Document identification |
113
+ | `akb_type` | enum | Distinguish hub/node |
114
+ | `status` | enum | Document lifecycle |
115
+ | `tags` | array | Domain classification (aids Grep search) |
116
+
117
+ ### Tags (Classification)
118
+
119
+ | Namespace | Purpose | Examples |
120
+ |-----------|---------|----------|
121
+ | `type/` | Document type | `type/how-to`, `type/reference`, `type/api-guide` |
122
+ | `domain/` | Domain classification | `domain/investigation`, `domain/blockchain` |
123
+
124
+ ---
125
+
126
+ ## Writing Principles (5 Rules)
127
+
128
+ ### Rule 1: TL;DR Required + Keyword Optimization
129
+
130
+ Include **key search terms naturally** so AI can find them via Grep.
131
+
132
+ ```markdown
133
+ ## TL;DR
134
+
135
+ - **AutoTrace** implements **FIFO tracking** strategy
136
+ - **DEX/Swap** transaction **routing** pattern handling
137
+ - **Bridge** cross-chain tracking logic
138
+ ```
139
+
140
+ **Guidelines:**
141
+ - 3-5 bullet points
142
+ - **Bold key terms** (Grep search targets)
143
+ - Keep each point to one line
144
+
145
+ ### Rule 2: Contextual Links (Inline)
146
+
147
+ Place links **within the flow of text**, not in isolated lists.
148
+
149
+ **Example 1: Natural inline placement**
150
+ ```markdown
151
+ The core of Lambda Admin is the **[4-Layer classification system](./4-layer-architecture.md)**.
152
+
153
+ The ontology store will migrate from ES to [Virtuoso/ClickHouse](./hybrid-federation.md).
154
+ ```
155
+
156
+ **Example 2: Next steps section**
157
+ ```markdown
158
+ ## Next Steps
159
+
160
+ - For DEX transaction handling → [dex-handling.md](./dex-handling.md)
161
+ - For Bridge tracking → [bridge-patterns.md](./bridge-patterns.md)
162
+ ```
163
+
164
+ **Why it works:** Context helps AI understand *why* it should follow the link.
165
+
166
+ **Less effective pattern:**
167
+ ```markdown
168
+ ## Related Documentation ← No context, just a list
169
+ - [4-layer-architecture.md](./4-layer-architecture.md)
170
+ - [hybrid-federation.md](./hybrid-federation.md)
171
+ ```
172
+ → Without context, AI can't judge *why* it should follow these links
173
+
174
+ ### Rule 3: Keyword-Optimized Filenames
175
+
176
+ Make files easy to find via Grep/Glob with **descriptive filenames**.
177
+
178
+ ```
179
+ ❌ Vague
180
+ notes.md
181
+ strategy.md
182
+
183
+ ✅ Clear
184
+ nexy-debugging.md
185
+ autotrace-fifo-strategy.md
186
+ bitcoin-utxo-handling.md
187
+ ```
188
+
189
+ ### Rule 4: Atomicity
190
+
191
+ - One document = one topic
192
+ - Keep under 200 lines (AI token efficiency)
193
+ - If too long, split and connect via Hub
194
+
195
+ ### Rule 5: Semantic vs Implementation Separation
196
+
197
+ > **Implementation (DDL, specs) → code repo** | **Semantic (meaning, relationships, why) → AKB**
198
+
199
+ AKB holds knowledge for AI to **understand context**. Implementation details belong in the code repo.
200
+
201
+ | Belongs in AKB | Belongs in Code Repo |
202
+ |----------------|---------------------|
203
+ | "Why we designed it this way" | DDL / migration files |
204
+ | Relationship diagrams (Mermaid) | OpenAPI specs |
205
+ | Design trade-offs | Config files (YAML/JSON) |
206
+
207
+ **Reasons:**
208
+ - **Sync issues**: Code changes require AKB updates → drift happens
209
+ - **Single Source of Truth**: Code is the source of truth
210
+ - **AKB essence**: Context for AI understanding ≠ implementation details
211
+
212
+ **Recommended pattern:**
213
+ ```markdown
214
+ > **DDL details**: See `{repo-name}` repo
215
+
216
+ [Mermaid ERD showing relationships only]
217
+
218
+ **Key design principles:**
219
+ - Why we chose this design
220
+ - What trade-offs exist
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Document Structure Template
226
+
227
+ ```markdown
228
+ # Title
229
+
230
+ ## TL;DR
231
+
232
+ - **Keyword1**: Description
233
+ - **Keyword2**: Description
234
+ - **Keyword3**: Description
235
+
236
+ ---
237
+
238
+ ## Body
239
+
240
+ ### Section 1
241
+
242
+ Content...
243
+ See `path/file.md` for reference. (explicit path)
244
+
245
+ ### Section 2
246
+
247
+ Content...
248
+
249
+ ---
250
+
251
+ ## Next Steps
252
+
253
+ - If [situation A] → [fileA.md](./fileA.md)
254
+ - If [situation B] → [fileB.md](./fileB.md)
255
+ - If [situation C] → [fileC.md](../folder/fileC.md)
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Hub Role
261
+
262
+ ```
263
+ Hub = TOC for humans
264
+ + keyword collection that aids Grep searches
265
+ ```
266
+
267
+ **Hub responsibilities:**
268
+ 1. Help humans understand folder contents
269
+ 2. Contain enough keywords to appear in Grep results
270
+ 3. AI reads selectively when it needs structural overview
271
+
272
+ ---
273
+
274
+ ## CLAUDE.md Routing Strategy
275
+
276
+ CLAUDE.md is included in the system prompt, so it has **size constraints**.
277
+
278
+ ### Routing Principles
279
+
280
+ ```markdown
281
+ # CLAUDE.md
282
+
283
+ ## Task Routing
284
+
285
+ | Task | Entry Point |
286
+ |------|-------------|
287
+ | AutoTrace overview | `investigation/autotrace/autotrace.md` (Hub) |
288
+ | FIFO tracking strategy | `investigation/autotrace/fifo-strategy.md` |
289
+ | DEX handling | `investigation/autotrace/dex-handling.md` |
290
+ ```
291
+
292
+ **Principles:**
293
+ - Frequently used core files → direct path
294
+ - Everything else → Hub reference
295
+
296
+ ---
297
+
298
+ ## vs Other Approaches
299
+
300
+ | Comparison | AKB | RAG | System Prompt |
301
+ |------------|-----|-----|---------------|
302
+ | Infrastructure | None | Vector DB | None |
303
+ | Token efficiency | Load only what's needed | Chunk-based | Load everything |
304
+ | AI navigation | Grep + contextual links | Similarity search | None |
305
+ | Maintenance | Edit files | Re-index | Edit prompt |
306
+
307
+ ---
308
+
309
+ ## Summary
310
+
311
+ > **AKB** is a file-based knowledge system designed so AI can autonomously navigate knowledge.
312
+
313
+ **Key points:**
314
+ - Minimal frontmatter (4 fields only)
315
+ - Connect via inline contextual links
316
+ - Hubs are TOCs for humans
317
+ - Optimize filenames and TL;DR for keyword search
318
+
319
+ > "Rather than changing AI behavior, optimize documents so AI can find them."
320
+
321
+ ---
322
+
323
+ ## Next Steps
324
+
325
+ - Tag system details → [tag-system.md](./tag-system.md)
326
+ - Naming conventions → [naming-convention.md](./naming-convention.md)
327
+
328
+ ---
329
+
330
+ ## Design Background
331
+
332
+ AKB was designed by analyzing actual AI agent behavior patterns.
333
+
334
+ **Observed AI behavior:**
335
+ - Skips Hubs, searches Nodes directly via Grep/Glob
336
+ - Does not parse frontmatter metadata (triggers, related, etc.)
337
+ - Follows links that appear inline with context
338
+
339
+ **Design principle:**
340
+ > "Don't try to change AI behavior — optimize documents so AI can find them naturally."
341
+
342
+ ### AKB Does Not Force Navigation on AI
343
+
344
+ **AKB's responsibility lies with the document designer.**
345
+
346
+ | Misconception | Correct Understanding |
347
+ |---------------|----------------------|
348
+ | "AI must consciously navigate using AKB" | AKB does not prescribe how AI navigates |
349
+ | "AI must meta-recognize Hub intersections" | AI naturally finds what it needs |
350
+ | "Is AI following AKB principles?" | If the answer is good, AKB worked |
351
+
352
+ **Key insight:**
353
+ > If AI found the information it needed and produced a good answer, that's proof AKB is working.
354
+ > AI doesn't need to be meta-aware of "Am I following AKB right now?"
355
+ > That's the document designer's responsibility, not the AI's.
@@ -1,94 +0,0 @@
1
- /**
2
- * claude-md-manager.ts — CLAUDE.md lifecycle management
3
- *
4
- * CLAUDE.md is 100% Tycono-managed. This module handles:
5
- * - Version tracking via .tycono/rules-version
6
- * - Auto-regeneration on version mismatch (server startup)
7
- * - Backup of pre-existing CLAUDE.md (first time only)
8
- * - Stub creation for knowledge/custom-rules.md
9
- */
10
- import fs from 'node:fs';
11
- import path from 'node:path';
12
- import { fileURLToPath } from 'node:url';
13
-
14
- const __filename = fileURLToPath(import.meta.url);
15
- const __dirname = path.dirname(__filename);
16
- const TEMPLATES_DIR = path.resolve(__dirname, '../../../../templates');
17
-
18
- /**
19
- * Read the current package version from package.json
20
- */
21
- function getPackageVersion(): string {
22
- const pkgPath = path.resolve(__dirname, '../../../../package.json');
23
- try {
24
- const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
25
- return pkg.version || '0.0.0';
26
- } catch {
27
- return '0.0.0';
28
- }
29
- }
30
-
31
- /**
32
- * Generate CLAUDE.md content from template with version marker
33
- */
34
- function generateClaudeMd(version: string): string {
35
- const tmplPath = path.join(TEMPLATES_DIR, 'CLAUDE.md.tmpl');
36
- const template = fs.readFileSync(tmplPath, 'utf-8');
37
- return template.replaceAll('{{VERSION}}', version);
38
- }
39
-
40
- /**
41
- * Ensure CLAUDE.md is up-to-date with the current package version.
42
- *
43
- * Called on server startup. Compares .tycono/rules-version with package version.
44
- * If different, regenerates CLAUDE.md from template (safe because CLAUDE.md
45
- * contains 0% user data — all user customization is in knowledge/custom-rules.md).
46
- */
47
- export function ensureClaudeMd(companyRoot: string): void {
48
- const tyconoDir = path.join(companyRoot, '.tycono');
49
- const rulesVersionPath = path.join(tyconoDir, 'rules-version');
50
- const claudeMdPath = path.join(companyRoot, 'knowledge', 'CLAUDE.md');
51
- const knowledgeDir = path.join(companyRoot, 'knowledge');
52
- const customRulesPath = path.join(knowledgeDir, 'custom-rules.md');
53
- const backupPath = path.join(tyconoDir, 'CLAUDE.md.backup');
54
-
55
- // Skip if not initialized (no .tycono/ directory)
56
- if (!fs.existsSync(tyconoDir)) return;
57
-
58
- const currentVersion = getPackageVersion();
59
-
60
- // Read stored version
61
- let storedVersion = '0.0.0';
62
- if (fs.existsSync(rulesVersionPath)) {
63
- storedVersion = fs.readFileSync(rulesVersionPath, 'utf-8').trim();
64
- }
65
-
66
- // Skip if already up-to-date
67
- if (storedVersion === currentVersion) return;
68
-
69
- // Backup existing CLAUDE.md (first time only — don't overwrite previous backup)
70
- if (fs.existsSync(claudeMdPath) && !fs.existsSync(backupPath)) {
71
- fs.copyFileSync(claudeMdPath, backupPath);
72
- console.log(`[CLAUDE.md] Backed up existing CLAUDE.md to .tycono/CLAUDE.md.backup`);
73
- }
74
-
75
- // Regenerate CLAUDE.md from template
76
- const content = generateClaudeMd(currentVersion);
77
- fs.writeFileSync(claudeMdPath, content);
78
-
79
- // Update rules-version
80
- fs.writeFileSync(rulesVersionPath, currentVersion);
81
-
82
- // Create custom-rules.md stub if not exists
83
- if (!fs.existsSync(customRulesPath)) {
84
- fs.writeFileSync(customRulesPath, `# Custom Rules
85
-
86
- > Company-specific rules, constraints, and processes.
87
- > This file is owned by you — Tycono will never overwrite it.
88
-
89
- <!-- Add your custom rules below -->
90
- `);
91
- }
92
-
93
- console.log(`[CLAUDE.md] System rules updated to v${currentVersion} (was v${storedVersion})`);
94
- }