@barissozen/csns 0.6.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.
Files changed (200) hide show
  1. package/.env.example +8 -0
  2. package/LICENSE +21 -0
  3. package/README.md +364 -0
  4. package/dist/agent/agent-runner.d.ts +48 -0
  5. package/dist/agent/agent-runner.d.ts.map +1 -0
  6. package/dist/agent/agent-runner.js +180 -0
  7. package/dist/agent/agent-runner.js.map +1 -0
  8. package/dist/agent/architect.d.ts +34 -0
  9. package/dist/agent/architect.d.ts.map +1 -0
  10. package/dist/agent/architect.js +156 -0
  11. package/dist/agent/architect.js.map +1 -0
  12. package/dist/agent/codebase-reader.d.ts +35 -0
  13. package/dist/agent/codebase-reader.d.ts.map +1 -0
  14. package/dist/agent/codebase-reader.js +305 -0
  15. package/dist/agent/codebase-reader.js.map +1 -0
  16. package/dist/agent/context-builder.d.ts +39 -0
  17. package/dist/agent/context-builder.d.ts.map +1 -0
  18. package/dist/agent/context-builder.js +163 -0
  19. package/dist/agent/context-builder.js.map +1 -0
  20. package/dist/agent/index.d.ts +14 -0
  21. package/dist/agent/index.d.ts.map +1 -0
  22. package/dist/agent/index.js +12 -0
  23. package/dist/agent/index.js.map +1 -0
  24. package/dist/agent/output-parser.d.ts +27 -0
  25. package/dist/agent/output-parser.d.ts.map +1 -0
  26. package/dist/agent/output-parser.js +154 -0
  27. package/dist/agent/output-parser.js.map +1 -0
  28. package/dist/agent/process-spawner.d.ts +56 -0
  29. package/dist/agent/process-spawner.d.ts.map +1 -0
  30. package/dist/agent/process-spawner.js +153 -0
  31. package/dist/agent/process-spawner.js.map +1 -0
  32. package/dist/agent/tracer/index.d.ts +8 -0
  33. package/dist/agent/tracer/index.d.ts.map +1 -0
  34. package/dist/agent/tracer/index.js +6 -0
  35. package/dist/agent/tracer/index.js.map +1 -0
  36. package/dist/agent/tracer/reverse-engineer.d.ts +113 -0
  37. package/dist/agent/tracer/reverse-engineer.d.ts.map +1 -0
  38. package/dist/agent/tracer/reverse-engineer.js +695 -0
  39. package/dist/agent/tracer/reverse-engineer.js.map +1 -0
  40. package/dist/agent/tracer/runtime-tracer.d.ts +61 -0
  41. package/dist/agent/tracer/runtime-tracer.d.ts.map +1 -0
  42. package/dist/agent/tracer/runtime-tracer.js +484 -0
  43. package/dist/agent/tracer/runtime-tracer.js.map +1 -0
  44. package/dist/agent/tracer/semantic-analyzer.d.ts +24 -0
  45. package/dist/agent/tracer/semantic-analyzer.d.ts.map +1 -0
  46. package/dist/agent/tracer/semantic-analyzer.js +132 -0
  47. package/dist/agent/tracer/semantic-analyzer.js.map +1 -0
  48. package/dist/agent/tracer/static-analyzer.d.ts +44 -0
  49. package/dist/agent/tracer/static-analyzer.d.ts.map +1 -0
  50. package/dist/agent/tracer/static-analyzer.js +453 -0
  51. package/dist/agent/tracer/static-analyzer.js.map +1 -0
  52. package/dist/agent/tracer/tracer-agent.d.ts +61 -0
  53. package/dist/agent/tracer/tracer-agent.d.ts.map +1 -0
  54. package/dist/agent/tracer/tracer-agent.js +252 -0
  55. package/dist/agent/tracer/tracer-agent.js.map +1 -0
  56. package/dist/bin/csns.d.ts +24 -0
  57. package/dist/bin/csns.d.ts.map +1 -0
  58. package/dist/bin/csns.js +389 -0
  59. package/dist/bin/csns.js.map +1 -0
  60. package/dist/bin/pc.d.ts +13 -0
  61. package/dist/bin/pc.d.ts.map +1 -0
  62. package/dist/bin/pc.js +212 -0
  63. package/dist/bin/pc.js.map +1 -0
  64. package/dist/brief/brief-collector.d.ts +42 -0
  65. package/dist/brief/brief-collector.d.ts.map +1 -0
  66. package/dist/brief/brief-collector.js +228 -0
  67. package/dist/brief/brief-collector.js.map +1 -0
  68. package/dist/brief/index.d.ts +3 -0
  69. package/dist/brief/index.d.ts.map +1 -0
  70. package/dist/brief/index.js +3 -0
  71. package/dist/brief/index.js.map +1 -0
  72. package/dist/brief/smart-brief.d.ts +52 -0
  73. package/dist/brief/smart-brief.d.ts.map +1 -0
  74. package/dist/brief/smart-brief.js +440 -0
  75. package/dist/brief/smart-brief.js.map +1 -0
  76. package/dist/calculator/calculator.d.ts +7 -0
  77. package/dist/calculator/calculator.d.ts.map +1 -0
  78. package/dist/calculator/calculator.js +18 -0
  79. package/dist/calculator/calculator.js.map +1 -0
  80. package/dist/calculator/index.d.ts +2 -0
  81. package/dist/calculator/index.d.ts.map +1 -0
  82. package/dist/calculator/index.js +2 -0
  83. package/dist/calculator/index.js.map +1 -0
  84. package/dist/i18n/en.d.ts +6 -0
  85. package/dist/i18n/en.d.ts.map +1 -0
  86. package/dist/i18n/en.js +136 -0
  87. package/dist/i18n/en.js.map +1 -0
  88. package/dist/i18n/index.d.ts +31 -0
  89. package/dist/i18n/index.d.ts.map +1 -0
  90. package/dist/i18n/index.js +44 -0
  91. package/dist/i18n/index.js.map +1 -0
  92. package/dist/i18n/tr.d.ts +6 -0
  93. package/dist/i18n/tr.d.ts.map +1 -0
  94. package/dist/i18n/tr.js +136 -0
  95. package/dist/i18n/tr.js.map +1 -0
  96. package/dist/i18n/types.d.ts +86 -0
  97. package/dist/i18n/types.d.ts.map +1 -0
  98. package/dist/i18n/types.js +9 -0
  99. package/dist/i18n/types.js.map +1 -0
  100. package/dist/index.d.ts +7 -0
  101. package/dist/index.d.ts.map +1 -0
  102. package/dist/index.js +72 -0
  103. package/dist/index.js.map +1 -0
  104. package/dist/llm/anthropic-provider.d.ts +18 -0
  105. package/dist/llm/anthropic-provider.d.ts.map +1 -0
  106. package/dist/llm/anthropic-provider.js +55 -0
  107. package/dist/llm/anthropic-provider.js.map +1 -0
  108. package/dist/llm/factory.d.ts +21 -0
  109. package/dist/llm/factory.d.ts.map +1 -0
  110. package/dist/llm/factory.js +59 -0
  111. package/dist/llm/factory.js.map +1 -0
  112. package/dist/llm/index.d.ts +7 -0
  113. package/dist/llm/index.d.ts.map +1 -0
  114. package/dist/llm/index.js +5 -0
  115. package/dist/llm/index.js.map +1 -0
  116. package/dist/llm/ollama-provider.d.ts +20 -0
  117. package/dist/llm/ollama-provider.d.ts.map +1 -0
  118. package/dist/llm/ollama-provider.js +62 -0
  119. package/dist/llm/ollama-provider.js.map +1 -0
  120. package/dist/llm/openai-provider.d.ts +20 -0
  121. package/dist/llm/openai-provider.d.ts.map +1 -0
  122. package/dist/llm/openai-provider.js +65 -0
  123. package/dist/llm/openai-provider.js.map +1 -0
  124. package/dist/llm/resolve.d.ts +10 -0
  125. package/dist/llm/resolve.d.ts.map +1 -0
  126. package/dist/llm/resolve.js +21 -0
  127. package/dist/llm/resolve.js.map +1 -0
  128. package/dist/llm/types.d.ts +45 -0
  129. package/dist/llm/types.d.ts.map +1 -0
  130. package/dist/llm/types.js +11 -0
  131. package/dist/llm/types.js.map +1 -0
  132. package/dist/memory/index.d.ts +2 -0
  133. package/dist/memory/index.d.ts.map +1 -0
  134. package/dist/memory/index.js +2 -0
  135. package/dist/memory/index.js.map +1 -0
  136. package/dist/memory/memory-layer.d.ts +54 -0
  137. package/dist/memory/memory-layer.d.ts.map +1 -0
  138. package/dist/memory/memory-layer.js +297 -0
  139. package/dist/memory/memory-layer.js.map +1 -0
  140. package/dist/orchestrator/dependency-graph.d.ts +39 -0
  141. package/dist/orchestrator/dependency-graph.d.ts.map +1 -0
  142. package/dist/orchestrator/dependency-graph.js +134 -0
  143. package/dist/orchestrator/dependency-graph.js.map +1 -0
  144. package/dist/orchestrator/escalator.d.ts +42 -0
  145. package/dist/orchestrator/escalator.d.ts.map +1 -0
  146. package/dist/orchestrator/escalator.js +163 -0
  147. package/dist/orchestrator/escalator.js.map +1 -0
  148. package/dist/orchestrator/evaluator.d.ts +34 -0
  149. package/dist/orchestrator/evaluator.d.ts.map +1 -0
  150. package/dist/orchestrator/evaluator.js +335 -0
  151. package/dist/orchestrator/evaluator.js.map +1 -0
  152. package/dist/orchestrator/index.d.ts +9 -0
  153. package/dist/orchestrator/index.d.ts.map +1 -0
  154. package/dist/orchestrator/index.js +9 -0
  155. package/dist/orchestrator/index.js.map +1 -0
  156. package/dist/orchestrator/integration-evaluator.d.ts +59 -0
  157. package/dist/orchestrator/integration-evaluator.d.ts.map +1 -0
  158. package/dist/orchestrator/integration-evaluator.js +405 -0
  159. package/dist/orchestrator/integration-evaluator.js.map +1 -0
  160. package/dist/orchestrator/milestone-manager.d.ts +28 -0
  161. package/dist/orchestrator/milestone-manager.d.ts.map +1 -0
  162. package/dist/orchestrator/milestone-manager.js +208 -0
  163. package/dist/orchestrator/milestone-manager.js.map +1 -0
  164. package/dist/orchestrator/orchestrator.d.ts +35 -0
  165. package/dist/orchestrator/orchestrator.d.ts.map +1 -0
  166. package/dist/orchestrator/orchestrator.js +338 -0
  167. package/dist/orchestrator/orchestrator.js.map +1 -0
  168. package/dist/orchestrator/planner.d.ts +15 -0
  169. package/dist/orchestrator/planner.d.ts.map +1 -0
  170. package/dist/orchestrator/planner.js +87 -0
  171. package/dist/orchestrator/planner.js.map +1 -0
  172. package/dist/orchestrator/recovery.d.ts +45 -0
  173. package/dist/orchestrator/recovery.d.ts.map +1 -0
  174. package/dist/orchestrator/recovery.js +98 -0
  175. package/dist/orchestrator/recovery.js.map +1 -0
  176. package/dist/run-calculator-test.d.ts +11 -0
  177. package/dist/run-calculator-test.d.ts.map +1 -0
  178. package/dist/run-calculator-test.js +212 -0
  179. package/dist/run-calculator-test.js.map +1 -0
  180. package/dist/run-real-task.d.ts +14 -0
  181. package/dist/run-real-task.d.ts.map +1 -0
  182. package/dist/run-real-task.js +185 -0
  183. package/dist/run-real-task.js.map +1 -0
  184. package/dist/run-todo-test.d.ts +6 -0
  185. package/dist/run-todo-test.d.ts.map +1 -0
  186. package/dist/run-todo-test.js +149 -0
  187. package/dist/run-todo-test.js.map +1 -0
  188. package/dist/todo/index.d.ts +2 -0
  189. package/dist/todo/index.d.ts.map +1 -0
  190. package/dist/todo/index.js +2 -0
  191. package/dist/todo/index.js.map +1 -0
  192. package/dist/todo/server.d.ts +2 -0
  193. package/dist/todo/server.d.ts.map +1 -0
  194. package/dist/todo/server.js +32 -0
  195. package/dist/todo/server.js.map +1 -0
  196. package/dist/types/index.d.ts +412 -0
  197. package/dist/types/index.d.ts.map +1 -0
  198. package/dist/types/index.js +5 -0
  199. package/dist/types/index.js.map +1 -0
  200. package/package.json +100 -0
package/.env.example ADDED
@@ -0,0 +1,8 @@
1
+ # Project Consciousness — Environment Variables
2
+ # Copy this file to .env and fill in your values
3
+
4
+ # Required for orchestrator (pc run)
5
+ ANTHROPIC_API_KEY=your_key_here
6
+
7
+ # Optional: Claude model override
8
+ # CLAUDE_MODEL=claude-sonnet-4-20250514
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Baris Sozen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,364 @@
1
+ # Project Consciousness
2
+
3
+ > Just say what you want. It handles the rest.
4
+
5
+ AI agents that don't ask you "which framework?" or "JWT or session?" — you describe what you need, the system makes the technical decisions itself.
6
+
7
+ **Multi-model** · **Multi-language** · **Memory-first** · **Self-correcting**
8
+
9
+ ---
10
+
11
+ ## Demo
12
+
13
+ ```
14
+ $ pc init
15
+
16
+ 📋 What do you want to build?
17
+ > I want a URL shortener with user registration, redirect on click,
18
+ links never expire
19
+
20
+ 🔍 Analyzing...
21
+ ✅ JWT Auth (registration detected)
22
+ ✅ SQLite (lightweight, sufficient)
23
+ ✅ REST API
24
+ ✅ TypeScript + Node.js
25
+
26
+ ❓ A few product questions:
27
+
28
+ Are shortened links public or login-only?
29
+ 1. Public
30
+ 2. Login only
31
+ 3. Both (configurable)
32
+ > 1
33
+
34
+ Can users see each other's links?
35
+ 1. Yes, everyone sees all
36
+ 2. No, only their own
37
+ 3. Optional sharing
38
+ > 2
39
+
40
+ ╔══════════════════════════════════════════════╗
41
+ ║ Plan Summary ║
42
+ ╚══════════════════════════════════════════════╝
43
+
44
+ ✅ JWT Auth ❌ No frontend (API only)
45
+ ✅ SQLite ❌ No payment system
46
+ ✅ REST API
47
+
48
+ $ pc run
49
+
50
+ 🚀 Orchestration starting...
51
+ 📦 Milestone M01: Foundation — DB schema, config
52
+ 📦 Milestone M02: Auth — register, login, JWT
53
+ 📦 Milestone M03: URL Shortener — CRUD, redirect
54
+ 🤖 Agent working: M01...
55
+ ✅ M01 completed (tsc ✅, test ✅)
56
+ 🤖 Agent working: M02...
57
+ ✅ M02 completed (tsc ✅, test ✅, endpoint ✅)
58
+ 🤖 Agent working: M03...
59
+ ✅ M03 completed (tsc ✅, test ✅, endpoint ✅)
60
+
61
+ ✅ Project complete — 3/3 milestones successful
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Install
67
+
68
+ ```bash
69
+ npx project-consciousness init # try instantly
70
+ # or
71
+ npm install -g project-consciousness
72
+ pc init
73
+ pc run
74
+ ```
75
+
76
+ **Requirements:** Node.js 20+, at least one LLM provider
77
+
78
+ ```bash
79
+ # Pick one:
80
+ export ANTHROPIC_API_KEY=sk-ant-... # Claude
81
+ export OPENAI_API_KEY=sk-... # GPT-4o / o-series
82
+ export OLLAMA_HOST=http://localhost:11434 # Local (Llama, Mistral, etc.)
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Multi-Model Support
88
+
89
+ Use any LLM provider — switch with a single env variable:
90
+
91
+ | Provider | Env Variable | Models |
92
+ |----------|-------------|--------|
93
+ | **Anthropic** (default) | `ANTHROPIC_API_KEY` | Claude Sonnet, Opus, Haiku |
94
+ | **OpenAI** | `OPENAI_API_KEY` | GPT-4o, o1, o3 |
95
+ | **Ollama** | `OLLAMA_HOST` | Llama 3, Mistral, CodeLlama, any local model |
96
+ | **OpenAI-compatible** | `OPENAI_API_KEY` + `LLM_BASE_URL` | Groq, Together, Azure, etc. |
97
+
98
+ ```bash
99
+ # Auto-detect: whichever key exists is used
100
+ export ANTHROPIC_API_KEY=sk-ant-...
101
+ pc run "Build a todo API"
102
+
103
+ # Explicit override
104
+ LLM_PROVIDER=openai OPENAI_API_KEY=sk-... pc run "Build a todo API"
105
+
106
+ # Local Ollama (no API key needed)
107
+ LLM_PROVIDER=ollama pc run "Build a todo API"
108
+ ```
109
+
110
+ ### Programmatic
111
+
112
+ ```typescript
113
+ import { createProvider } from 'project-consciousness/llm';
114
+
115
+ // Auto-detect from env
116
+ const provider = createProvider();
117
+
118
+ // Or explicit
119
+ const claude = createProvider({ provider: 'anthropic', apiKey: 'sk-ant-...' });
120
+ const gpt = createProvider({ provider: 'openai', apiKey: 'sk-...', model: 'gpt-4o' });
121
+ const local = createProvider({ provider: 'ollama', model: 'llama3' });
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Multi-Language (i18n)
127
+
128
+ All user-facing messages, prompts, and agent personas support multiple languages:
129
+
130
+ ```bash
131
+ PC_LOCALE=en pc run "Build a todo API" # English (default)
132
+ PC_LOCALE=tr pc run "Todo API yap" # Türkçe
133
+ ```
134
+
135
+ Currently supported: **English** (`en`), **Turkish** (`tr`). Adding a new locale is one file — see `src/i18n/`.
136
+
137
+ ---
138
+
139
+ ## Agent CLI Abstraction
140
+
141
+ The orchestrator spawns coding agents via CLI. Default is Claude Code, but any compatible CLI works:
142
+
143
+ ```bash
144
+ AGENT_BINARY=claude pc run "..." # Claude Code (default)
145
+ AGENT_BINARY=codex pc run "..." # OpenAI Codex CLI
146
+ AGENT_BINARY=aider pc run "..." # Aider
147
+ ```
148
+
149
+ The agent receives a prompt via stdin and returns structured output. Any CLI that accepts `--print` mode or stdin prompts can be plugged in.
150
+
151
+ ---
152
+
153
+ ## How It Works
154
+
155
+ ### The 4-File Memory System
156
+
157
+ Everything runs on 4 markdown files. Agents read them before every task and never forget why they exist.
158
+
159
+ | File | What It Contains | Owned By |
160
+ |------|-----------------|----------|
161
+ | `MISSION.md` | What to build, what NOT to build, success criteria | You (immutable) |
162
+ | `ARCHITECTURE.md` | Technical decisions — auth, DB, API style | System (auto) |
163
+ | `DECISIONS.md` | Every decision, why it was made, when | Log (append-only) |
164
+ | `STATE.md` | Current phase, what's done, what's left | Live status |
165
+
166
+ ### Architecture
167
+
168
+ ```
169
+ You: "I want a URL shortener..."
170
+
171
+
172
+ ┌─────────────────────────────────┐
173
+ │ SmartBrief │
174
+ │ 1 question → analysis → │
175
+ │ product questions only │
176
+ │ → MISSION.md + ARCHITECTURE.md │
177
+ └──────────┬──────────────────────┘
178
+
179
+ ┌─────────────────────────────────┐
180
+ │ Orchestrator │
181
+ │ Plan → Milestone → Agent → Test │
182
+ │ Failed? → 3x retry → ask you │
183
+ └──────────┬──────────────────────┘
184
+
185
+ ┌─────────────────────────────────┐
186
+ │ Memory Layer │
187
+ │ Every decision → DECISIONS.md │
188
+ │ Every step → STATE.md │
189
+ │ Nothing is lost │
190
+ └─────────────────────────────────┘
191
+ ```
192
+
193
+ ### What It Asks vs. What It Decides
194
+
195
+ | Asks you ✅ | Decides itself ❌ |
196
+ |---|---|
197
+ | "Are links public or private?" | JWT or session? |
198
+ | "Can users see each other's data?" | Which database? |
199
+ | "Will there be payments?" | REST or GraphQL? |
200
+ | "Do links expire?" | File structure? |
201
+
202
+ Technical decisions are inferred from your brief. Only **product decisions** — things you need to know — are asked.
203
+
204
+ ### Quality Control Pipeline
205
+
206
+ After code is written, it's verified:
207
+
208
+ 1. **Type checking** — `tsc --noEmit`
209
+ 2. **Test execution** — `vitest run` / `pytest` / `go test`
210
+ 3. **HTTP endpoint testing** — server started, real HTTP requests sent
211
+ 4. **Anti-scope enforcement** — protected files touched? forbidden deps added?
212
+
213
+ Failed? 3x auto-retry with feedback → still failing? → escalation to you.
214
+
215
+ ### Tracer Agent — Data Flow Inspector
216
+
217
+ A specialized agent that "walks" through the project, tracking data flow and finding wiring problems:
218
+
219
+ ```typescript
220
+ import { TracerAgent } from 'project-consciousness/agent';
221
+
222
+ const tracer = new TracerAgent({
223
+ projectRoot: process.cwd(),
224
+ llmProvider: provider, // any LLMProvider
225
+ port: 3000,
226
+ });
227
+
228
+ const report = await tracer.run();
229
+ // report.staticIssues → dead exports, circular deps, phantom deps
230
+ // report.semanticInsights → LLM-detected injection gaps, config mismatches
231
+ // report.runtimeTraces → HTTP probe results, handler chains, data flow
232
+ ```
233
+
234
+ **3-layer analysis:**
235
+
236
+ | Layer | What | How |
237
+ |-------|------|-----|
238
+ | **Static** | Import/export graph, dead code, circular deps, phantom deps | Regex scan of all `.ts` files |
239
+ | **Semantic** | "This service should be injected but isn't" | LLM reasoning over graph + file summaries |
240
+ | **Runtime** | Server started, HTTP probed, handler chain traced | Express middleware injection + HTTP probing |
241
+
242
+ ---
243
+
244
+ ## CLI Commands
245
+
246
+ | Command | What It Does |
247
+ |---------|-------------|
248
+ | `pc init` | Collect brief → create 4 memory files |
249
+ | `pc run` | Start the orchestrator |
250
+ | `pc run "Build a todo API"` | Start with inline brief |
251
+ | `pc status` | Show STATE.md |
252
+ | `pc log` | Show DECISIONS.md |
253
+ | `pc help` | Help |
254
+
255
+ ---
256
+
257
+ ## Traceability
258
+
259
+ Everything is logged, nothing is deleted:
260
+
261
+ ```markdown
262
+ ## D024 — Codebase Context: Pre-Task File Reading
263
+ - **Date**: 2026-03-24T02:30:00+03:00
264
+ - **Decision**: CodebaseReader scans src/, selects relevant files per task
265
+ - **Rationale**: Agent must know existing code, otherwise writes duplicates
266
+ - **Status**: active
267
+ ```
268
+
269
+ 6 months later: "why did we do it this way?" → `DECISIONS.md`.
270
+
271
+ ---
272
+
273
+ ## Configuration
274
+
275
+ ### Environment Variables
276
+
277
+ | Variable | Description | Default |
278
+ |----------|------------|---------|
279
+ | `ANTHROPIC_API_KEY` | Anthropic API key | — |
280
+ | `OPENAI_API_KEY` | OpenAI API key | — |
281
+ | `OLLAMA_HOST` | Ollama server URL | `http://localhost:11434` |
282
+ | `LLM_PROVIDER` | Force provider: `anthropic`, `openai`, `ollama` | auto-detect |
283
+ | `LLM_MODEL` | Model name | provider default |
284
+ | `LLM_BASE_URL` | Custom API base URL (OpenAI-compatible) | — |
285
+ | `AGENT_BINARY` | Coding agent CLI binary | `claude` |
286
+ | `PC_LOCALE` | Language: `en`, `tr` | `en` |
287
+
288
+ ### Programmatic
289
+
290
+ ```typescript
291
+ import { Orchestrator } from 'project-consciousness/orchestrator';
292
+
293
+ const orchestrator = new Orchestrator({
294
+ projectRoot: process.cwd(),
295
+ llmProvider: 'openai',
296
+ llmApiKey: 'sk-...',
297
+ llmModel: 'gpt-4o',
298
+ agentBinary: 'claude',
299
+ locale: 'en',
300
+ maxRetries: 3,
301
+ escalationThreshold: 0.4,
302
+ maxParallelAgents: 3,
303
+ verbose: true,
304
+ });
305
+
306
+ const session = await orchestrator.run('Build a REST API for todos');
307
+ ```
308
+
309
+ ---
310
+
311
+ ## Developer Notes
312
+
313
+ ### Project Structure
314
+
315
+ ```
316
+ src/
317
+ ├── brief/ SmartBrief + BriefCollector
318
+ ├── agent/ Agent Runner, Context Builder, Codebase Reader
319
+ │ └── tracer/ Tracer Agent (static + semantic + runtime analysis)
320
+ ├── orchestrator/ Planner, Evaluator, Escalator, Integration Evaluator
321
+ ├── memory/ 4-file read/write layer
322
+ ├── llm/ LLM provider abstraction (Anthropic, OpenAI, Ollama)
323
+ ├── i18n/ Internationalization (en, tr)
324
+ ├── types/ TypeScript interfaces
325
+ └── bin/ CLI (pc init/run/status/log)
326
+ ```
327
+
328
+ ### Test
329
+
330
+ ```bash
331
+ npm test # 229 tests, 19 suites
332
+ npx vitest run tests/tracer-agent.test.ts # specific suite
333
+ SKIP_E2E=1 npm test # skip real CLI tests
334
+ ```
335
+
336
+ TypeScript strict mode, 0 errors. Vitest for testing.
337
+
338
+ ### Stack
339
+
340
+ - **TypeScript + Node.js** — strict mode, ESM
341
+ - **LLM Providers** — Anthropic SDK, OpenAI API, Ollama REST (pluggable)
342
+ - **Agent Execution** — Claude Code CLI (configurable)
343
+ - **Testing** — Vitest (229 tests)
344
+ - **Storage** — File system (markdown, no DB)
345
+
346
+ ### Design Principles
347
+
348
+ 1. **Memory-First** — Every decision leaves a trace in files
349
+ 2. **Fail-Safe** — When in doubt, ask the human
350
+ 3. **Append-Only** — DECISIONS.md is never edited
351
+ 4. **Minimal** — File system is enough, no DB needed
352
+ 5. **Human-Readable** — All state is markdown
353
+ 6. **Provider-Agnostic** — Works with any LLM, any agent CLI
354
+
355
+ ### Contributing
356
+
357
+ 1. Fork → branch → test → PR
358
+ 2. `npm test` must pass
359
+ 3. `npx tsc --noEmit` must show 0 errors
360
+ 4. Conventional commits (`feat:`, `fix:`, `docs:`)
361
+
362
+ ## License
363
+
364
+ MIT — [Baris Sozen](https://github.com/BarisSozen)
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Agent Runner — Claude Code Instance Yöneticisi
3
+ *
4
+ * Agent'ları spawn eder, memory context'i prompt'a enjekte eder,
5
+ * çıktıyı parse eder ve orchestrator'a döndürür.
6
+ *
7
+ * Karar D003: GSD-2 üstüne katman — subagent mekanizması kullanır
8
+ * Karar D004: Agent'lar Claude Code ile çalışır
9
+ */
10
+ import type { AgentConfig, AgentResult, MemorySnapshot, TaskDefinition } from '../types/index.js';
11
+ export interface AgentRunnerConfig {
12
+ /** Claude CLI binary path (default: 'claude') */
13
+ binaryPath?: string;
14
+ /** Working directory for agents */
15
+ workingDirectory: string;
16
+ /** Timeout per agent execution in ms (default: 120_000) */
17
+ timeout?: number;
18
+ /** Max recursion depth (prevents infinite agent spawning) */
19
+ maxDepth?: number;
20
+ /** Allowed tools for agents (default: ['Read', 'Write', 'Edit', 'Bash']) */
21
+ allowedTools?: string[];
22
+ /** Additional environment variables for agents */
23
+ env?: Record<string, string>;
24
+ /** Log function */
25
+ log?: (message: string) => void;
26
+ }
27
+ export declare class AgentRunner {
28
+ private agents;
29
+ private spawner;
30
+ private contextBuilder;
31
+ private outputParser;
32
+ private config;
33
+ private log;
34
+ constructor(config: AgentRunnerConfig);
35
+ registerAgent(config: AgentConfig): void;
36
+ getAgent(id: string): AgentConfig | undefined;
37
+ private registerDefaultAgents;
38
+ checkHealth(): Promise<{
39
+ ready: boolean;
40
+ details: string;
41
+ }>;
42
+ runTask(task: TaskDefinition, memory: MemorySnapshot): Promise<AgentResult>;
43
+ runParallel(tasks: TaskDefinition[], memory: MemorySnapshot, maxConcurrent: number): Promise<AgentResult[]>;
44
+ private buildCliFlags;
45
+ private selectAgent;
46
+ private failResult;
47
+ }
48
+ //# sourceMappingURL=agent-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-runner.d.ts","sourceRoot":"","sources":["../../src/agent/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,cAAc,EACd,cAAc,EACf,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,gBAAgB,EAAE,MAAM,CAAC;IACzB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,mBAAmB;IACnB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,GAAG,CAA4B;gBAE3B,MAAM,EAAE,iBAAiB;IAerC,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAIxC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAI7C,OAAO,CAAC,qBAAqB;IA4BvB,WAAW,IAAI,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IA0B3D,OAAO,CACX,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,WAAW,CAAC;IAgEjB,WAAW,CACf,KAAK,EAAE,cAAc,EAAE,EACvB,MAAM,EAAE,cAAc,EACtB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,EAAE,CAAC;IA+BzB,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,UAAU;CAenB"}
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Agent Runner — Claude Code Instance Yöneticisi
3
+ *
4
+ * Agent'ları spawn eder, memory context'i prompt'a enjekte eder,
5
+ * çıktıyı parse eder ve orchestrator'a döndürür.
6
+ *
7
+ * Karar D003: GSD-2 üstüne katman — subagent mekanizması kullanır
8
+ * Karar D004: Agent'lar Claude Code ile çalışır
9
+ */
10
+ import { ProcessSpawner } from './process-spawner.js';
11
+ import { ContextBuilder } from './context-builder.js';
12
+ import { OutputParser } from './output-parser.js';
13
+ import { t } from '../i18n/index.js';
14
+ export class AgentRunner {
15
+ agents = new Map();
16
+ spawner;
17
+ contextBuilder;
18
+ outputParser;
19
+ config;
20
+ log;
21
+ constructor(config) {
22
+ this.config = config;
23
+ this.spawner = new ProcessSpawner(config.binaryPath ?? 'claude', config.timeout ?? 120_000);
24
+ this.contextBuilder = new ContextBuilder();
25
+ this.outputParser = new OutputParser();
26
+ this.log = config.log ?? console.log;
27
+ this.registerDefaultAgents();
28
+ }
29
+ // ── Agent Registration ──────────────────────────────────
30
+ registerAgent(config) {
31
+ this.agents.set(config.id, config);
32
+ }
33
+ getAgent(id) {
34
+ return this.agents.get(id);
35
+ }
36
+ registerDefaultAgents() {
37
+ this.registerAgent({
38
+ id: 'coder',
39
+ type: 'coder',
40
+ capabilities: ['write-code', 'refactor', 'implement-feature'],
41
+ });
42
+ this.registerAgent({
43
+ id: 'reviewer',
44
+ type: 'reviewer',
45
+ capabilities: ['code-review', 'consistency-check', 'quality-audit'],
46
+ });
47
+ this.registerAgent({
48
+ id: 'tester',
49
+ type: 'tester',
50
+ capabilities: ['write-tests', 'run-tests', 'coverage-analysis'],
51
+ });
52
+ this.registerAgent({
53
+ id: 'documenter',
54
+ type: 'documenter',
55
+ capabilities: ['write-docs', 'update-readme', 'api-docs'],
56
+ });
57
+ }
58
+ // ── Health Check ────────────────────────────────────────
59
+ async checkHealth() {
60
+ // Sonsuz döngü koruması
61
+ const depth = parseInt(process.env['PC_AGENT_DEPTH'] ?? '0', 10);
62
+ if (depth >= (this.config.maxDepth ?? 3)) {
63
+ return {
64
+ ready: false,
65
+ details: `Max agent depth reached (${depth}/${this.config.maxDepth ?? 3})`
66
+ };
67
+ }
68
+ const health = await this.spawner.healthCheck();
69
+ if (!health.available) {
70
+ return {
71
+ ready: false,
72
+ details: `Claude CLI not available: ${health.error}`,
73
+ };
74
+ }
75
+ return {
76
+ ready: true,
77
+ details: `Claude CLI ${health.version ?? 'unknown'} ready, depth: ${depth}`,
78
+ };
79
+ }
80
+ // ── Single Task Execution ───────────────────────────────
81
+ async runTask(task, memory) {
82
+ const agentId = this.selectAgent(task);
83
+ const agent = this.agents.get(agentId);
84
+ if (!agent) {
85
+ return this.failResult(task.id, agentId, `No agent found for type: ${task.type}`);
86
+ }
87
+ this.log(t().agentStarting(agent.id, task.id));
88
+ // 1. Memory-aware prompt oluştur
89
+ const prompt = this.contextBuilder.buildPrompt(task, memory, agent);
90
+ this.log(t().promptReady(prompt.length));
91
+ // 2. Claude CLI spawn et
92
+ const startTime = Date.now();
93
+ try {
94
+ // Build CLI flags for tool permissions
95
+ const flags = this.buildCliFlags();
96
+ const processResult = await this.spawner.spawn({
97
+ prompt,
98
+ cwd: this.config.workingDirectory,
99
+ timeout: this.config.timeout,
100
+ flags,
101
+ env: this.config.env,
102
+ });
103
+ // 3. Timeout kontrolü
104
+ if (processResult.timedOut) {
105
+ this.log(t().agentTimeout(processResult.duration));
106
+ return this.failResult(task.id, agent.id, `Agent timed out after ${processResult.duration}ms`, processResult.duration);
107
+ }
108
+ // 4. Çıktıyı parse et
109
+ const result = this.outputParser.parse(task.id, agent.id, processResult.stdout, processResult.stderr, processResult.exitCode, processResult.duration);
110
+ this.log(` ${result.success ? '✅' : '❌'} ${t().agentComplete(agent.id, processResult.duration)}`);
111
+ return result;
112
+ }
113
+ catch (error) {
114
+ const duration = Date.now() - startTime;
115
+ const message = error instanceof Error ? error.message : 'Unknown error';
116
+ this.log(t().agentError(agent.id, message));
117
+ return this.failResult(task.id, agent.id, message, duration);
118
+ }
119
+ }
120
+ // ── Parallel Execution ──────────────────────────────────
121
+ async runParallel(tasks, memory, maxConcurrent) {
122
+ const results = [];
123
+ this.log(t().parallelBatch(0, Math.ceil(tasks.length / maxConcurrent), tasks.map(t2 => t2.id).join(', ')));
124
+ // Batch'ler halinde çalıştır
125
+ for (let i = 0; i < tasks.length; i += maxConcurrent) {
126
+ const batch = tasks.slice(i, i + maxConcurrent);
127
+ const batchNum = Math.floor(i / maxConcurrent) + 1;
128
+ const totalBatches = Math.ceil(tasks.length / maxConcurrent);
129
+ this.log(t().parallelBatch(batchNum, totalBatches, batch.map(t2 => t2.id).join(', ')));
130
+ // Her batch'te memory'yi yeniden oku (önceki batch'in değişiklikleri yansısın)
131
+ // İlk batch hariç — ilk batch zaten güncel memory'yi kullanıyor
132
+ const batchResults = await Promise.all(batch.map(task => this.runTask(task, memory)));
133
+ results.push(...batchResults);
134
+ // Batch sonuçlarını logla
135
+ const succeeded = batchResults.filter(r => r.success).length;
136
+ this.log(t().batchResult(batchNum, succeeded, batchResults.length));
137
+ }
138
+ return results;
139
+ }
140
+ // ── CLI Flags ────────────────────────────────────────────
141
+ buildCliFlags() {
142
+ const flags = [];
143
+ // Permission bypass — agent'lar sandbox'ta çalışır, tool'ları kullanabilmeli
144
+ flags.push('--dangerously-skip-permissions');
145
+ // Allowed tools — sadece dosya operasyonları ve bash
146
+ const tools = this.config.allowedTools ?? ['Read', 'Write', 'Edit', 'Bash'];
147
+ if (tools.length > 0) {
148
+ flags.push('--allowedTools', tools.join(','));
149
+ }
150
+ return flags;
151
+ }
152
+ // ── Agent Selection ─────────────────────────────────────
153
+ selectAgent(task) {
154
+ // Task'a explicit agent atanmışsa onu kullan
155
+ if (task.agent) {
156
+ return task.agent;
157
+ }
158
+ // Task type'a göre agent seç
159
+ switch (task.type) {
160
+ case 'code': return 'coder';
161
+ case 'review': return 'reviewer';
162
+ case 'test': return 'tester';
163
+ case 'document': return 'documenter';
164
+ case 'decision': return 'coder';
165
+ default: return 'coder';
166
+ }
167
+ }
168
+ // ── Helpers ─────────────────────────────────────────────
169
+ failResult(taskId, agentId, error, duration = 0) {
170
+ return {
171
+ taskId,
172
+ agentId,
173
+ success: false,
174
+ output: `Error: ${error}`,
175
+ artifacts: [],
176
+ duration,
177
+ };
178
+ }
179
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K,UAAU,CAAC,CAAC,OAAO,OAAO,CAAC;YAChC,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,2DAA2D;IAEnD,UAAU,CAChB,MAAc,EACd,OAAe,EACf,KAAa,EACb,QAAQ,GAAG,CAAC;QAEZ,OAAO;YACL,MAAM;YACN,OAAO;YACP,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,UAAU,KAAK,EAAE;YACzB,SAAS,EAAE,EAAE;YACb,QAAQ;SACT,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Architect Agent — Kodlamaya Başlamadan Önce Mimari Kararlar
3
+ *
4
+ * Brief geldikten sonra kullanıcıya mimari sorular sorar.
5
+ * Cevapları ARCHITECTURE.md'ye yazar.
6
+ * Sonraki agent'lar bu kararları okur, tekrar sormaz.
7
+ *
8
+ * Tasarım ilkesi #1: Memory-First — her karar hafızada iz bırakır
9
+ */
10
+ import type { ArchitectureDecisions } from '../types/index.js';
11
+ export declare class ArchitectAgent {
12
+ private _askFn;
13
+ /** Test injection */
14
+ setAskFn(fn: (prompt: string) => Promise<string>): void;
15
+ /**
16
+ * İnteraktif CLI ile kullanıcıdan mimari kararları topla
17
+ */
18
+ runInteractive(): Promise<ArchitectureDecisions>;
19
+ /**
20
+ * Test/CI için direkt cevap ver
21
+ */
22
+ runWithDefaults(answers: ArchitectureDecisions): ArchitectureDecisions;
23
+ /**
24
+ * Kararları ARCHITECTURE.md'ye yaz
25
+ */
26
+ writeToArchitecture(decisions: ArchitectureDecisions, archPath: string): Promise<void>;
27
+ /**
28
+ * ARCHITECTURE.md'den kararları parse et
29
+ */
30
+ static parseDecisions(content: string): ArchitectureDecisions | null;
31
+ private collectAnswers;
32
+ private renderDecisions;
33
+ }
34
+ //# sourceMappingURL=architect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../../src/agent/architect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,qBAAqB,EAAwE,MAAM,mBAAmB,CAAC;AA0DrI,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAsD;IAEpE,qBAAqB;IACrB,QAAQ,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI;IAIvD;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAgBtD;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,qBAAqB;IAItE;;OAEG;IACG,mBAAmB,CAAC,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB5F;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI;YAoBtD,cAAc;IAuB5B,OAAO,CAAC,eAAe;CAWxB"}