darwin-agents 0.4.4

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 (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +245 -0
  3. package/dist/agents/analyst.d.ts +11 -0
  4. package/dist/agents/analyst.d.ts.map +1 -0
  5. package/dist/agents/analyst.js +78 -0
  6. package/dist/agents/analyst.js.map +1 -0
  7. package/dist/agents/blog-writer.d.ts +13 -0
  8. package/dist/agents/blog-writer.d.ts.map +1 -0
  9. package/dist/agents/blog-writer.js +59 -0
  10. package/dist/agents/blog-writer.js.map +1 -0
  11. package/dist/agents/critic.d.ts +11 -0
  12. package/dist/agents/critic.d.ts.map +1 -0
  13. package/dist/agents/critic.js +57 -0
  14. package/dist/agents/critic.js.map +1 -0
  15. package/dist/agents/index.d.ts +15 -0
  16. package/dist/agents/index.d.ts.map +1 -0
  17. package/dist/agents/index.js +31 -0
  18. package/dist/agents/index.js.map +1 -0
  19. package/dist/agents/investigator-critic.d.ts +10 -0
  20. package/dist/agents/investigator-critic.d.ts.map +1 -0
  21. package/dist/agents/investigator-critic.js +78 -0
  22. package/dist/agents/investigator-critic.js.map +1 -0
  23. package/dist/agents/investigator.d.ts +13 -0
  24. package/dist/agents/investigator.d.ts.map +1 -0
  25. package/dist/agents/investigator.js +105 -0
  26. package/dist/agents/investigator.js.map +1 -0
  27. package/dist/agents/marketing.d.ts +13 -0
  28. package/dist/agents/marketing.d.ts.map +1 -0
  29. package/dist/agents/marketing.js +59 -0
  30. package/dist/agents/marketing.js.map +1 -0
  31. package/dist/agents/researcher.d.ts +11 -0
  32. package/dist/agents/researcher.d.ts.map +1 -0
  33. package/dist/agents/researcher.js +68 -0
  34. package/dist/agents/researcher.js.map +1 -0
  35. package/dist/agents/writer.d.ts +9 -0
  36. package/dist/agents/writer.d.ts.map +1 -0
  37. package/dist/agents/writer.js +47 -0
  38. package/dist/agents/writer.js.map +1 -0
  39. package/dist/cli/create.d.ts +11 -0
  40. package/dist/cli/create.d.ts.map +1 -0
  41. package/dist/cli/create.js +104 -0
  42. package/dist/cli/create.js.map +1 -0
  43. package/dist/cli/evolve.d.ts +13 -0
  44. package/dist/cli/evolve.d.ts.map +1 -0
  45. package/dist/cli/evolve.js +69 -0
  46. package/dist/cli/evolve.js.map +1 -0
  47. package/dist/cli/index.d.ts +13 -0
  48. package/dist/cli/index.d.ts.map +1 -0
  49. package/dist/cli/index.js +84 -0
  50. package/dist/cli/index.js.map +1 -0
  51. package/dist/cli/init.d.ts +12 -0
  52. package/dist/cli/init.d.ts.map +1 -0
  53. package/dist/cli/init.js +68 -0
  54. package/dist/cli/init.js.map +1 -0
  55. package/dist/cli/run.d.ts +7 -0
  56. package/dist/cli/run.d.ts.map +1 -0
  57. package/dist/cli/run.js +371 -0
  58. package/dist/cli/run.js.map +1 -0
  59. package/dist/cli/status.d.ts +7 -0
  60. package/dist/cli/status.d.ts.map +1 -0
  61. package/dist/cli/status.js +123 -0
  62. package/dist/cli/status.js.map +1 -0
  63. package/dist/core/agent.d.ts +53 -0
  64. package/dist/core/agent.d.ts.map +1 -0
  65. package/dist/core/agent.js +172 -0
  66. package/dist/core/agent.js.map +1 -0
  67. package/dist/core/runner.d.ts +64 -0
  68. package/dist/core/runner.d.ts.map +1 -0
  69. package/dist/core/runner.js +203 -0
  70. package/dist/core/runner.js.map +1 -0
  71. package/dist/evolution/loop.d.ts +100 -0
  72. package/dist/evolution/loop.d.ts.map +1 -0
  73. package/dist/evolution/loop.js +424 -0
  74. package/dist/evolution/loop.js.map +1 -0
  75. package/dist/evolution/multi-critic.d.ts +58 -0
  76. package/dist/evolution/multi-critic.d.ts.map +1 -0
  77. package/dist/evolution/multi-critic.js +324 -0
  78. package/dist/evolution/multi-critic.js.map +1 -0
  79. package/dist/evolution/notifications.d.ts +32 -0
  80. package/dist/evolution/notifications.d.ts.map +1 -0
  81. package/dist/evolution/notifications.js +92 -0
  82. package/dist/evolution/notifications.js.map +1 -0
  83. package/dist/evolution/optimizer.d.ts +64 -0
  84. package/dist/evolution/optimizer.d.ts.map +1 -0
  85. package/dist/evolution/optimizer.js +223 -0
  86. package/dist/evolution/optimizer.js.map +1 -0
  87. package/dist/evolution/patterns.d.ts +63 -0
  88. package/dist/evolution/patterns.d.ts.map +1 -0
  89. package/dist/evolution/patterns.js +297 -0
  90. package/dist/evolution/patterns.js.map +1 -0
  91. package/dist/evolution/safety.d.ts +76 -0
  92. package/dist/evolution/safety.d.ts.map +1 -0
  93. package/dist/evolution/safety.js +182 -0
  94. package/dist/evolution/safety.js.map +1 -0
  95. package/dist/evolution/tracker.d.ts +48 -0
  96. package/dist/evolution/tracker.d.ts.map +1 -0
  97. package/dist/evolution/tracker.js +163 -0
  98. package/dist/evolution/tracker.js.map +1 -0
  99. package/dist/index.d.ts +32 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +35 -0
  102. package/dist/index.js.map +1 -0
  103. package/dist/memory/index.d.ts +32 -0
  104. package/dist/memory/index.d.ts.map +1 -0
  105. package/dist/memory/index.js +49 -0
  106. package/dist/memory/index.js.map +1 -0
  107. package/dist/memory/postgres-memory.d.ts +52 -0
  108. package/dist/memory/postgres-memory.d.ts.map +1 -0
  109. package/dist/memory/postgres-memory.js +515 -0
  110. package/dist/memory/postgres-memory.js.map +1 -0
  111. package/dist/memory/sqlite-memory.d.ts +36 -0
  112. package/dist/memory/sqlite-memory.d.ts.map +1 -0
  113. package/dist/memory/sqlite-memory.js +380 -0
  114. package/dist/memory/sqlite-memory.js.map +1 -0
  115. package/dist/providers/anthropic.d.ts +20 -0
  116. package/dist/providers/anthropic.d.ts.map +1 -0
  117. package/dist/providers/anthropic.js +82 -0
  118. package/dist/providers/anthropic.js.map +1 -0
  119. package/dist/providers/claude-cli.d.ts +35 -0
  120. package/dist/providers/claude-cli.d.ts.map +1 -0
  121. package/dist/providers/claude-cli.js +143 -0
  122. package/dist/providers/claude-cli.js.map +1 -0
  123. package/dist/providers/index.d.ts +39 -0
  124. package/dist/providers/index.d.ts.map +1 -0
  125. package/dist/providers/index.js +58 -0
  126. package/dist/providers/index.js.map +1 -0
  127. package/dist/providers/ollama.d.ts +17 -0
  128. package/dist/providers/ollama.d.ts.map +1 -0
  129. package/dist/providers/ollama.js +64 -0
  130. package/dist/providers/ollama.js.map +1 -0
  131. package/dist/providers/openai.d.ts +19 -0
  132. package/dist/providers/openai.d.ts.map +1 -0
  133. package/dist/providers/openai.js +75 -0
  134. package/dist/providers/openai.js.map +1 -0
  135. package/dist/providers/types.d.ts +62 -0
  136. package/dist/providers/types.d.ts.map +1 -0
  137. package/dist/providers/types.js +9 -0
  138. package/dist/providers/types.js.map +1 -0
  139. package/dist/types.d.ts +221 -0
  140. package/dist/types.d.ts.map +1 -0
  141. package/dist/types.js +19 -0
  142. package/dist/types.js.map +1 -0
  143. package/package.json +81 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 StudioMeyer
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,245 @@
1
+ # darwin
2
+
3
+ **AI agents that improve themselves.**
4
+
5
+ Build AI agent teams that learn from every run. Self-evolving prompts. A/B tested. Safety-gated.
6
+
7
+ ```bash
8
+ npm install darwin-agents better-sqlite3
9
+ export ANTHROPIC_API_KEY=sk-ant-... # or OPENAI_API_KEY, or use Claude CLI
10
+ npx darwin run writer "Explain quantum computing simply"
11
+ ```
12
+
13
+ ---
14
+
15
+ ## What is this?
16
+
17
+ Darwin is a TypeScript framework for building AI agents that **automatically optimize their own prompts** through experimentation, evaluation, and evolution.
18
+
19
+ Traditional AI agents use static prompts. You write them once, and they never improve. Darwin changes that:
20
+
21
+ 1. Your agent runs a task
22
+ 2. A Critic agent evaluates the output (quality, sources, structure)
23
+ 3. After enough runs, Darwin detects patterns ("weak on technical topics")
24
+ 4. It generates an improved prompt variant
25
+ 5. A/B tests the new variant against the current one
26
+ 6. The winner becomes the default — your agent got better, automatically
27
+
28
+ ```
29
+ You run an agent
30
+
31
+
32
+ Darwin measures quality
33
+
34
+
35
+ Patterns emerge over time
36
+
37
+
38
+ New prompt variant generated
39
+
40
+
41
+ A/B tested against current
42
+
43
+
44
+ Winner becomes default
45
+
46
+ Your agent got better.
47
+ You did nothing.
48
+ ```
49
+
50
+ ## Quick Start
51
+
52
+ ```bash
53
+ # Install
54
+ npm install darwin-agents better-sqlite3
55
+
56
+ # Set your API key (or use Claude CLI if installed)
57
+ export ANTHROPIC_API_KEY=sk-ant-...
58
+
59
+ # Run your first agent
60
+ npx darwin run writer "Explain the CAP theorem in simple terms"
61
+
62
+ # Enable evolution
63
+ npx darwin evolve writer --enable
64
+
65
+ # Watch it improve over time
66
+ npx darwin status writer
67
+ ```
68
+
69
+ ### Define your own agent in 12 lines
70
+
71
+ ```typescript
72
+ import { defineAgent } from 'darwin-agents';
73
+
74
+ export default defineAgent({
75
+ name: 'summarizer',
76
+ role: 'Text Summarizer',
77
+ description: 'Summarizes text into key points.',
78
+ systemPrompt: `Summarize the given text in 3 bullet points.
79
+ Be concise. No fluff. Capture the essence.`,
80
+ evolution: {
81
+ enabled: true,
82
+ evaluator: 'critic',
83
+ },
84
+ });
85
+ ```
86
+
87
+ ## Built-in Agents
88
+
89
+ | Agent | What it does | Needs |
90
+ |-------|-------------|-------|
91
+ | **writer** | Content writing, explanations, copy | Nothing (zero-config) |
92
+ | **researcher** | Web research with source citations | Tavily API key |
93
+ | **critic** | Evaluates other agents' output (1-10) | Nothing |
94
+ | **analyst** | Code quality analysis | Filesystem access |
95
+
96
+ ## How Evolution Works
97
+
98
+ <!-- REAL_METRICS_START -->
99
+
100
+ ### Real results from 300+ production runs
101
+
102
+ These are actual metrics from our development — not synthetic benchmarks.
103
+
104
+ ```
105
+ Agents: writer, researcher, marketing, blog-writer
106
+ Total Runs: 300+
107
+ Success Rate: 100%
108
+
109
+ Writer: 7.2/10 (120 runs across tech, webdesign, market)
110
+ Marketing: 7.8/10 (70 runs across LinkedIn, Instagram)
111
+ Researcher: 7.6/10 (50+ runs, web research with citations)
112
+ ```
113
+
114
+ #### Multi-Model Critics in action
115
+
116
+ ```
117
+ platform-compliance ████████░░ 8/10
118
+ scroll-stopping ████████░░ 8/10
119
+ conversion-intent ████████░░ 8/10
120
+ ```
121
+
122
+ <!-- REAL_METRICS_END -->
123
+
124
+ ## Feature Comparison
125
+
126
+ | Feature | Darwin | EvoAgentX | DSPy | CrewAI | AutoGen |
127
+ |---------|--------|-----------|------|--------|---------|
128
+ | Self-evolving prompts | **Yes** | Yes | Yes (compiler) | No | No |
129
+ | A/B testing | **Yes** | No | No | No | No |
130
+ | Safety gate + rollback | **Yes** | No | No | No | No |
131
+ | TypeScript native | **Yes** | No (Python) | No (Python) | No (Python) | No (Python) |
132
+ | Zero-config first agent | **Yes** | No | No | No | Partial |
133
+ | MCP native | **Yes** | No | No | No | No |
134
+ | File-based (no DB required) | **Yes** | No | No | No | No |
135
+ | Built-in Critic agent | **Yes** | No | No | No | No |
136
+
137
+ ## Architecture
138
+
139
+ ```
140
+ darwin/
141
+ ├── src/
142
+ │ ├── core/ # Agent runner, config, MCP handling
143
+ │ ├── memory/ # SQLite storage (experiments, prompts, learnings)
144
+ │ ├── evolution/ # Darwin loop, A/B testing, safety gate, patterns
145
+ │ ├── agents/ # Built-in agents (writer, researcher, critic, analyst)
146
+ │ └── cli/ # CLI commands (run, status, evolve, create)
147
+ ```
148
+
149
+ ### Memory System
150
+
151
+ Darwin uses SQLite by default — zero config, single file, no database to install.
152
+
153
+ ```
154
+ .darwin/
155
+ ├── darwin.db # All experiments, prompts, learnings
156
+ └── reports/ # Markdown reports per run
157
+ ├── exp-writer-2026-03-08-001.md
158
+ └── exp-researcher-2026-03-08-002.md
159
+ ```
160
+
161
+ **Want semantic search, cross-agent learnings, and analytics?**
162
+ Upgrade to [Darwin Pro](#darwin-pro) for PostgreSQL + pgvector support.
163
+
164
+ ## CLI Reference
165
+
166
+ ```bash
167
+ darwin run <agent> "task" # Run an agent
168
+ darwin run writer "Hello" --task-type tech # With task categorization
169
+ darwin run analyst --path ./src # Analyze a codebase
170
+
171
+ darwin status # Overview of all agents
172
+ darwin status writer # Detailed agent stats + evolution history
173
+
174
+ darwin evolve writer --enable # Enable self-evolution
175
+ darwin evolve writer --reset # Reset to v1
176
+
177
+ darwin create my-agent # Scaffold a new agent
178
+ ```
179
+
180
+ ## Darwin Pro
181
+
182
+ The free version uses SQLite — great for getting started, handles thousands of experiments.
183
+
184
+ For teams and production use, Darwin Pro adds:
185
+
186
+ | Feature | Free (SQLite) | Pro (PostgreSQL) |
187
+ |---------|:---:|:---:|
188
+ | Experiment tracking | ✓ | ✓ |
189
+ | Prompt versioning | ✓ | ✓ |
190
+ | A/B testing | ✓ | ✓ |
191
+ | Safety gate | ✓ | ✓ |
192
+ | Keyword search | ✓ | ✓ |
193
+ | **Semantic search** (pgvector) | — | ✓ |
194
+ | **Cross-agent learnings** | — | ✓ |
195
+ | **Analytics & time series** | — | ✓ |
196
+ | **Contradiction detection** | — | ✓ |
197
+ | **Team support** (multi-user) | — | ✓ |
198
+ | **Data export** (CSV/JSON) | — | ✓ |
199
+ | **Learning decay** | — | ✓ |
200
+
201
+ *Coming soon. Follow the repo for updates.*
202
+
203
+ ## FAQ
204
+
205
+ **What do I need to run Darwin?**
206
+ Node.js 20+ and one of: Claude CLI (default provider), `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or a local Ollama instance. For storage, install `better-sqlite3` (default) or use PostgreSQL via `DARWIN_POSTGRES_URL`.
207
+
208
+ **Does Darwin work with models other than Claude?**
209
+ Yes! Darwin supports multiple providers: Claude CLI (default), Anthropic API, OpenAI/compatible APIs, and Ollama (local). Set `provider` in your config or use `DARWIN_PROVIDER` env var.
210
+
211
+ **How many runs until I see improvement?**
212
+ Around 10 runs. First 5 establish a baseline, then Darwin generates a variant and A/B tests it over the next 5 runs.
213
+
214
+ **Is my data safe?**
215
+ Everything stays local. SQLite file on your disk. No telemetry, no cloud, no data leaves your machine.
216
+
217
+ **Can I use this for non-English tasks?**
218
+ Yes. Agents detect language automatically. Darwin's evaluation is language-agnostic.
219
+
220
+ **What if Darwin makes my agent worse?**
221
+ The safety gate prevents regressions. If a new variant scores >20% lower, Darwin automatically rolls back to the last known-good version.
222
+
223
+ ## Known Limitations
224
+
225
+ - **LLM-as-Judge bias**: Critics use LLMs to evaluate LLM outputs. We mitigate this with multi-model critics (GPT + Claude), but inherent self-preference bias exists. [Research context](https://openreview.net/forum?id=Ns8zGZ0lmM).
226
+ - **Statistical simplicity**: A/B tests use mean comparison with a 5% threshold, not formal significance tests (t-test, Mann-Whitney U). `computeDynamicMinRuns()` adjusts sample sizes based on variance, but p-values are on the roadmap.
227
+ - **No human-in-the-loop approval**: Prompt mutations go directly to A/B testing. Telegram notifications inform you, but there's no approval gate before testing starts.
228
+
229
+ ## Contributing
230
+
231
+ PRs welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
232
+
233
+ ## License
234
+
235
+ MIT — use freely, commercially or personally.
236
+
237
+ ---
238
+
239
+ <div align="center">
240
+
241
+ **Darwin: Your agents don't just run. They evolve.**
242
+
243
+ Built by [StudioMeyer](https://studiomeyer.de)
244
+
245
+ </div>
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Analyst Agent — Code Intelligence
3
+ *
4
+ * Analyzes codebases for quality, patterns, security issues,
5
+ * and improvement opportunities.
6
+ *
7
+ * Uses filesystem access (Read, Glob, Grep tools).
8
+ */
9
+ import type { AgentDefinition } from '../types.js';
10
+ export declare const analyst: AgentDefinition;
11
+ //# sourceMappingURL=analyst.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyst.d.ts","sourceRoot":"","sources":["../../src/agents/analyst.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,OAAO,EAAE,eAqErB,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Analyst Agent — Code Intelligence
3
+ *
4
+ * Analyzes codebases for quality, patterns, security issues,
5
+ * and improvement opportunities.
6
+ *
7
+ * Uses filesystem access (Read, Glob, Grep tools).
8
+ */
9
+ export const analyst = {
10
+ name: 'analyst',
11
+ role: 'Code Analyst',
12
+ description: 'Analyzes codebases for quality, patterns, and issues. Finds what humans miss.',
13
+ maxTurns: 25,
14
+ tools: ['Read', 'Glob', 'Grep', 'Bash'],
15
+ systemPrompt: `You are a senior code analyst who reviews codebases for quality and issues.
16
+
17
+ YOUR MISSION:
18
+ Analyze the given codebase or file path and deliver a structured quality report.
19
+
20
+ ANALYSIS PROCESS:
21
+ 1. Scan the project structure (Glob for key files: package.json, tsconfig, etc.)
22
+ 2. Read key files to understand architecture
23
+ 3. Search for common issues (Grep for patterns)
24
+ 4. Evaluate code quality, security, and architecture
25
+
26
+ WHAT TO LOOK FOR:
27
+ - **Architecture**: Project structure, dependency management, module boundaries
28
+ - **Code Quality**: TypeScript strictness, error handling, naming conventions
29
+ - **Security**: Hardcoded secrets, injection risks, unsafe patterns
30
+ - **Performance**: N+1 queries, missing indexes, unnecessary re-renders
31
+ - **Dead Code**: Unused exports, unreachable branches, commented-out code
32
+ - **Dependencies**: Outdated packages, known vulnerabilities, bundle size
33
+
34
+ SEVERITY LEVELS:
35
+ - P0 (Critical): Security vulnerabilities, data loss risks
36
+ - P1 (High): Bugs, performance issues, architectural problems
37
+ - P2 (Medium): Code quality, maintainability issues
38
+ - P3 (Low): Style, naming, minor improvements
39
+
40
+ RULES:
41
+ - Only report issues you can PROVE (show the file and line)
42
+ - Don't nitpick formatting — focus on substance
43
+ - Prioritize by impact, not by count
44
+ - Suggest concrete fixes, not vague advice
45
+ - If the code is good, say so — don't invent problems
46
+
47
+ OUTPUT FORMAT:
48
+ # Code Analysis: {Project/Path}
49
+
50
+ ## Summary
51
+ {2-3 sentences: overall health, biggest concern, biggest strength}
52
+
53
+ ## Critical Issues (P0-P1)
54
+ ### {Issue Title}
55
+ - **File**: {path}:{line}
56
+ - **Problem**: {specific description}
57
+ - **Fix**: {concrete suggestion}
58
+
59
+ ## Improvements (P2-P3)
60
+ - {issue + file + suggestion}
61
+
62
+ ## Architecture Notes
63
+ {Observations about structure, patterns, decisions}
64
+
65
+ ## Score: {1-10}/10`,
66
+ evolution: {
67
+ enabled: true,
68
+ evaluator: 'critic',
69
+ metrics: {
70
+ quality: 0.45,
71
+ sourceCount: 0.05,
72
+ outputLength: 0.15,
73
+ duration: 0.10,
74
+ success: 0.25,
75
+ },
76
+ },
77
+ };
78
+ //# sourceMappingURL=analyst.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyst.js","sourceRoot":"","sources":["../../src/agents/analyst.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,CAAC,MAAM,OAAO,GAAoB;IACtC,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,+EAA+E;IAC5F,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IACvC,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAkDI;IAElB,SAAS,EAAE;QACT,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE;YACP,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,IAAI;YACjB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;SACd;KACF;CACF,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Blog Writer Agent — SEO-Optimized Content
3
+ *
4
+ * Writes SEO-optimized blog posts with keyword focus.
5
+ * No MCP tools — pure text generation.
6
+ * Blog-specific critics: SEO, readability, conversion.
7
+ *
8
+ * Customize brand/site by providing context in the task prompt
9
+ * or by creating a custom agent with defineAgent().
10
+ */
11
+ import type { AgentDefinition } from '../types.js';
12
+ export declare const blogWriter: AgentDefinition;
13
+ //# sourceMappingURL=blog-writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog-writer.d.ts","sourceRoot":"","sources":["../../src/agents/blog-writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,UAAU,EAAE,eAgDxB,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Blog Writer Agent — SEO-Optimized Content
3
+ *
4
+ * Writes SEO-optimized blog posts with keyword focus.
5
+ * No MCP tools — pure text generation.
6
+ * Blog-specific critics: SEO, readability, conversion.
7
+ *
8
+ * Customize brand/site by providing context in the task prompt
9
+ * or by creating a custom agent with defineAgent().
10
+ */
11
+ export const blogWriter = {
12
+ name: 'blog-writer',
13
+ role: 'SEO Blog Writer',
14
+ description: 'Writes SEO-optimized blog posts. Keyword-aware, structured for readability and conversion.',
15
+ maxTurns: 8,
16
+ systemPrompt: `You are a senior SEO content writer for a premium digital agency.
17
+
18
+ BLOG STANDARDS:
19
+ - Write in the language the user specifies (default: English)
20
+ - Target audience: SMB owners considering digital solutions, website redesign, or new projects
21
+ - Tone: Expert but accessible. Explain tech concepts simply. No jargon without explanation.
22
+ - Length: 800-1500 words unless specified otherwise
23
+
24
+ SEO RULES:
25
+ - Include the main keyword in: Title, first paragraph, one H2, meta description
26
+ - Use 3-5 H2 headers with keyword variations (not exact stuffing)
27
+ - Write a compelling meta description (max 155 chars)
28
+ - Suggest internal link opportunities where relevant
29
+ - Use short paragraphs (max 3-4 sentences)
30
+ - Include a FAQ section with 3 questions (structured data opportunity)
31
+
32
+ CONTENT QUALITY:
33
+ - Lead with the reader's problem, not the solution
34
+ - Include at least one concrete example, case study, or data point
35
+ - Address objections ("But what about...") proactively
36
+ - Every section must answer "why should I care?"
37
+ - End with clear CTA (contact, consultation, related post)
38
+ - NEVER invent statistics. Use "typically", "in our experience" for estimates.
39
+
40
+ OUTPUT FORMAT:
41
+ 1. Title (H1) — compelling, keyword-included, under 60 chars
42
+ 2. Meta Description — under 155 chars
43
+ 3. Main content with H2 headers
44
+ 4. FAQ section (3 questions)
45
+ 5. CTA paragraph
46
+ 6. Suggested internal links`,
47
+ evolution: {
48
+ enabled: true,
49
+ evaluator: 'multi-critic',
50
+ metrics: {
51
+ quality: 0.55,
52
+ sourceCount: 0.0,
53
+ outputLength: 0.15,
54
+ duration: 0.05,
55
+ success: 0.25,
56
+ },
57
+ },
58
+ };
59
+ //# sourceMappingURL=blog-writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog-writer.js","sourceRoot":"","sources":["../../src/agents/blog-writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,CAAC,MAAM,UAAU,GAAoB;IACzC,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,4FAA4F;IACzG,QAAQ,EAAE,CAAC;IACX,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA8BY;IAE1B,SAAS,EAAE;QACT,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,cAAc;QACzB,OAAO,EAAE;YACP,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,GAAG;YAChB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;SACd;KACF;CACF,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Critic Agent — The Heart of Darwin
3
+ *
4
+ * Evaluates other agents' output. Without the Critic,
5
+ * there's no quality score, no evolution, no improvement.
6
+ *
7
+ * Zero-config: no MCP servers, no API keys.
8
+ */
9
+ import type { AgentDefinition } from '../types.js';
10
+ export declare const critic: AgentDefinition;
11
+ //# sourceMappingURL=critic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"critic.d.ts","sourceRoot":"","sources":["../../src/agents/critic.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,MAAM,EAAE,eAgDpB,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Critic Agent — The Heart of Darwin
3
+ *
4
+ * Evaluates other agents' output. Without the Critic,
5
+ * there's no quality score, no evolution, no improvement.
6
+ *
7
+ * Zero-config: no MCP servers, no API keys.
8
+ */
9
+ export const critic = {
10
+ name: 'critic',
11
+ role: "Devil's Advocate & Quality Evaluator",
12
+ description: "Reviews and scores other agents' output. Enables Darwin evolution through quality feedback.",
13
+ maxTurns: 5,
14
+ systemPrompt: `You are a sharp, constructive critic who evaluates AI agent outputs.
15
+
16
+ YOUR ROLE:
17
+ Score the quality of an agent's output on a scale of 1-10 and provide specific feedback.
18
+
19
+ EVALUATION CRITERIA:
20
+ 1. **Accuracy** (0-10): Are claims factual? Are sources cited? Any hallucinations?
21
+ 2. **Completeness** (0-10): Does it fully address the task? Missing angles?
22
+ 3. **Structure** (0-10): Well-organized? Clear headers? Logical flow?
23
+ 4. **Actionability** (0-10): Can the reader act on this? Concrete next steps?
24
+ 5. **Conciseness** (0-10): Right level of detail? No filler?
25
+
26
+ SCORING GUIDE:
27
+ - 9-10: Exceptional. Would publish as-is.
28
+ - 7-8: Good. Minor improvements possible.
29
+ - 5-6: Adequate. Significant gaps or issues.
30
+ - 3-4: Poor. Major problems.
31
+ - 1-2: Unusable. Fundamentally flawed.
32
+
33
+ RULES:
34
+ - Be SPECIFIC. Not "could be better" but "Section 3 lacks source citations for the market size claim"
35
+ - Be CONSTRUCTIVE. Every criticism must include a fix suggestion
36
+ - Be HONEST. A score of 7 when it deserves 4 helps nobody
37
+ - Evaluate the OUTPUT, not the effort
38
+ - Consider the task type: research needs sources, code needs correctness, content needs readability
39
+
40
+ OUTPUT FORMAT (EXACTLY THIS — parseable by Darwin):
41
+ ===SCORE===
42
+ {number 1-10}
43
+ ===STRENGTHS===
44
+ - {specific strength 1}
45
+ - {specific strength 2}
46
+ ===WEAKNESSES===
47
+ - {specific weakness 1 + fix suggestion}
48
+ - {specific weakness 2 + fix suggestion}
49
+ ===VERDICT===
50
+ {One sentence summary}
51
+ ===END===`,
52
+ evolution: {
53
+ enabled: false, // Critic doesn't evolve itself (avoids circular dependency)
54
+ evaluator: 'critic',
55
+ },
56
+ };
57
+ //# sourceMappingURL=critic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"critic.js","sourceRoot":"","sources":["../../src/agents/critic.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,sCAAsC;IAC5C,WAAW,EAAE,6FAA6F;IAC1G,QAAQ,EAAE,CAAC;IACX,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAqCN;IAER,SAAS,EAAE;QACT,OAAO,EAAE,KAAK,EAAG,4DAA4D;QAC7E,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Built-in Agents — ready to use out of the box.
3
+ */
4
+ export { writer } from './writer.js';
5
+ export { researcher } from './researcher.js';
6
+ export { critic } from './critic.js';
7
+ export { analyst } from './analyst.js';
8
+ export { investigator } from './investigator.js';
9
+ export { investigatorCritic } from './investigator-critic.js';
10
+ export { marketing } from './marketing.js';
11
+ export { blogWriter } from './blog-writer.js';
12
+ import type { AgentDefinition } from '../types.js';
13
+ /** All built-in agents by name */
14
+ export declare const builtinAgents: Record<string, AgentDefinition>;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAU9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,kCAAkC;AAClC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CASzD,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Built-in Agents — ready to use out of the box.
3
+ */
4
+ export { writer } from './writer.js';
5
+ export { researcher } from './researcher.js';
6
+ export { critic } from './critic.js';
7
+ export { analyst } from './analyst.js';
8
+ export { investigator } from './investigator.js';
9
+ export { investigatorCritic } from './investigator-critic.js';
10
+ export { marketing } from './marketing.js';
11
+ export { blogWriter } from './blog-writer.js';
12
+ import { writer } from './writer.js';
13
+ import { researcher } from './researcher.js';
14
+ import { critic } from './critic.js';
15
+ import { analyst } from './analyst.js';
16
+ import { investigator } from './investigator.js';
17
+ import { investigatorCritic } from './investigator-critic.js';
18
+ import { marketing } from './marketing.js';
19
+ import { blogWriter } from './blog-writer.js';
20
+ /** All built-in agents by name */
21
+ export const builtinAgents = {
22
+ writer,
23
+ researcher,
24
+ critic,
25
+ analyst,
26
+ investigator,
27
+ 'investigator-critic': investigatorCritic,
28
+ marketing,
29
+ 'blog-writer': blogWriter,
30
+ };
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,kCAAkC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAoC;IAC5D,MAAM;IACN,UAAU;IACV,MAAM;IACN,OAAO;IACP,YAAY;IACZ,qBAAqB,EAAE,kBAAkB;IACzC,SAAS;IACT,aAAa,EAAE,UAAU;CAC1B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Investigator Critic — Bewertet investigative Reports
3
+ *
4
+ * Andere Kriterien als der Standard-Critic:
5
+ * Nicht "ist es gut geschrieben?" sondern
6
+ * "ist es EHRLICH, AUSGEWOGEN und TIEF?"
7
+ */
8
+ import type { AgentDefinition } from '../types.js';
9
+ export declare const investigatorCritic: AgentDefinition;
10
+ //# sourceMappingURL=investigator-critic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"investigator-critic.d.ts","sourceRoot":"","sources":["../../src/agents/investigator-critic.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,kBAAkB,EAAE,eAsEhC,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Investigator Critic — Bewertet investigative Reports
3
+ *
4
+ * Andere Kriterien als der Standard-Critic:
5
+ * Nicht "ist es gut geschrieben?" sondern
6
+ * "ist es EHRLICH, AUSGEWOGEN und TIEF?"
7
+ */
8
+ export const investigatorCritic = {
9
+ name: 'investigator-critic',
10
+ role: 'Investigation Quality Evaluator',
11
+ description: 'Evaluates investigative reports on honesty, balance, depth, and source diversity — not just writing quality.',
12
+ maxTurns: 5,
13
+ systemPrompt: `You evaluate investigative research reports on controversial topics.
14
+
15
+ YOU DO NOT CARE ABOUT:
16
+ - Pretty writing or formatting
17
+ - Whether the conclusion is "mainstream-approved"
18
+ - Political correctness
19
+ - Whether it might offend someone
20
+
21
+ YOU CARE ABOUT:
22
+ 1. **Honesty** (0-10): Does it say what it actually thinks, or does it hide behind diplomatic language? Does it take a position or cop out with "both sides have valid points"? Cowardly fence-sitting = low score.
23
+
24
+ 2. **Balance** (0-10): Are BOTH sides presented with their STRONGEST arguments? Or is one side a strawman? Does it steelman the unpopular position? Note: Balance does NOT mean 50/50 — if evidence is 80/20, a balanced report says so.
25
+
26
+ 3. **Source Diversity** (0-10): Does it cite ONLY mainstream sources? ONLY alternative sources? Or a genuine MIX? Are primary documents included? Are sources from different countries/perspectives? Wikipedia + CNN alone = low score. Government documents + academic papers + independent journalists = high score.
27
+
28
+ 4. **Depth** (0-10): Surface-level summary or actual investigation? Does it name specific people, dates, documents? Does it follow the money? Does it ask WHO BENEFITS? Generic "some experts say" = low score.
29
+
30
+ 5. **Intellectual Courage** (0-10): Does it challenge comfortable assumptions? Does it state uncomfortable conclusions? Does it point out what we genuinely don't know? Or does it play it safe and repeat what everyone already thinks?
31
+
32
+ SCORING GUIDE:
33
+ - 9-10: Genuinely investigative. I learned something. Both sides treated fairly. Clear honest conclusion.
34
+ - 7-8: Good research but plays it a bit safe. Solid sources, some fence-sitting.
35
+ - 5-6: Surface level. Mostly mainstream rehash with token mention of alternatives.
36
+ - 3-4: Propaganda dressed as research. Only one side taken seriously.
37
+ - 1-2: Copy-paste from Wikipedia. No actual investigation.
38
+
39
+ RED FLAGS (automatic -2 penalty):
40
+ - "This has been thoroughly debunked" without showing the debunking evidence
41
+ - "Conspiracy theory" used as dismissal rather than description
42
+ - No alternative sources at all
43
+ - Conclusion was obviously predetermined before investigation
44
+ - "More research is needed" as the ONLY conclusion
45
+
46
+ GREEN FLAGS (+1 bonus):
47
+ - Primary documents cited (leaked emails, government reports, declassified files)
48
+ - Named specific people and their conflicts of interest
49
+ - Changed direction mid-investigation based on evidence found
50
+ - Stated something uncomfortable with evidence to back it up
51
+
52
+ OUTPUT FORMAT (EXACTLY THIS — parseable by Darwin):
53
+ ===SCORE===
54
+ {number 1-10}
55
+ ===HONESTY===
56
+ {score}/10 — {specific assessment}
57
+ ===BALANCE===
58
+ {score}/10 — {specific assessment}
59
+ ===SOURCE_DIVERSITY===
60
+ {score}/10 — {specific assessment}
61
+ ===DEPTH===
62
+ {score}/10 — {specific assessment}
63
+ ===COURAGE===
64
+ {score}/10 — {specific assessment}
65
+ ===STRENGTHS===
66
+ - {specific strength 1}
67
+ - {specific strength 2}
68
+ ===WEAKNESSES===
69
+ - {specific weakness 1 + what would make it better}
70
+ - {specific weakness 2 + what would make it better}
71
+ ===VERDICT===
72
+ {One honest sentence — was this real investigation or theatre?}
73
+ ===END===`,
74
+ evolution: {
75
+ enabled: false,
76
+ },
77
+ };
78
+ //# sourceMappingURL=investigator-critic.js.map