@agntk/agent-harness 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +41 -0
  3. package/README.md +445 -0
  4. package/defaults/agents/summarizer.md +49 -0
  5. package/defaults/instincts/lead-with-answer.md +24 -0
  6. package/defaults/instincts/qualify-before-recommending.md +40 -0
  7. package/defaults/instincts/read-before-edit.md +23 -0
  8. package/defaults/instincts/search-before-create.md +23 -0
  9. package/defaults/playbooks/ship-feature.md +31 -0
  10. package/defaults/rules/ask-before-assuming.md +35 -0
  11. package/defaults/rules/operations.md +35 -0
  12. package/defaults/rules/respect-the-user.md +39 -0
  13. package/defaults/skills/business-analyst.md +181 -0
  14. package/defaults/skills/content-marketer.md +184 -0
  15. package/defaults/skills/research.md +34 -0
  16. package/defaults/tools/example-web-search.md +60 -0
  17. package/defaults/workflows/daily-reflection.md +54 -0
  18. package/dist/agent-framework-K4GUIICH.js +344 -0
  19. package/dist/agent-framework-K4GUIICH.js.map +1 -0
  20. package/dist/analytics-RPT73WNM.js +12 -0
  21. package/dist/analytics-RPT73WNM.js.map +1 -0
  22. package/dist/auto-processor-OLE45UI3.js +13 -0
  23. package/dist/auto-processor-OLE45UI3.js.map +1 -0
  24. package/dist/chunk-274RV3YO.js +162 -0
  25. package/dist/chunk-274RV3YO.js.map +1 -0
  26. package/dist/chunk-4CWAGBNS.js +168 -0
  27. package/dist/chunk-4CWAGBNS.js.map +1 -0
  28. package/dist/chunk-4FDUOGSZ.js +69 -0
  29. package/dist/chunk-4FDUOGSZ.js.map +1 -0
  30. package/dist/chunk-5H34JPMB.js +199 -0
  31. package/dist/chunk-5H34JPMB.js.map +1 -0
  32. package/dist/chunk-6EMOEYGU.js +102 -0
  33. package/dist/chunk-6EMOEYGU.js.map +1 -0
  34. package/dist/chunk-A7BJPQQ6.js +236 -0
  35. package/dist/chunk-A7BJPQQ6.js.map +1 -0
  36. package/dist/chunk-AGAAFJEO.js +76 -0
  37. package/dist/chunk-AGAAFJEO.js.map +1 -0
  38. package/dist/chunk-BSKDOFRT.js +65 -0
  39. package/dist/chunk-BSKDOFRT.js.map +1 -0
  40. package/dist/chunk-CHJ5GNZC.js +100 -0
  41. package/dist/chunk-CHJ5GNZC.js.map +1 -0
  42. package/dist/chunk-CSL3ERUI.js +307 -0
  43. package/dist/chunk-CSL3ERUI.js.map +1 -0
  44. package/dist/chunk-DA7IKHC4.js +229 -0
  45. package/dist/chunk-DA7IKHC4.js.map +1 -0
  46. package/dist/chunk-DGUM43GV.js +11 -0
  47. package/dist/chunk-DGUM43GV.js.map +1 -0
  48. package/dist/chunk-DTTXPHFW.js +211 -0
  49. package/dist/chunk-DTTXPHFW.js.map +1 -0
  50. package/dist/chunk-FD55B3IO.js +204 -0
  51. package/dist/chunk-FD55B3IO.js.map +1 -0
  52. package/dist/chunk-FLZU44SV.js +230 -0
  53. package/dist/chunk-FLZU44SV.js.map +1 -0
  54. package/dist/chunk-GJNNR2RA.js +200 -0
  55. package/dist/chunk-GJNNR2RA.js.map +1 -0
  56. package/dist/chunk-GNUSHD2Y.js +111 -0
  57. package/dist/chunk-GNUSHD2Y.js.map +1 -0
  58. package/dist/chunk-GUJTBGVS.js +2212 -0
  59. package/dist/chunk-GUJTBGVS.js.map +1 -0
  60. package/dist/chunk-IZ6UZ3ZL.js +207 -0
  61. package/dist/chunk-IZ6UZ3ZL.js.map +1 -0
  62. package/dist/chunk-JKMGYWXB.js +197 -0
  63. package/dist/chunk-JKMGYWXB.js.map +1 -0
  64. package/dist/chunk-KFX54TQM.js +165 -0
  65. package/dist/chunk-KFX54TQM.js.map +1 -0
  66. package/dist/chunk-M7NXUK55.js +199 -0
  67. package/dist/chunk-M7NXUK55.js.map +1 -0
  68. package/dist/chunk-MPZ3BPUI.js +374 -0
  69. package/dist/chunk-MPZ3BPUI.js.map +1 -0
  70. package/dist/chunk-OC6YSTDX.js +119 -0
  71. package/dist/chunk-OC6YSTDX.js.map +1 -0
  72. package/dist/chunk-RC6MEZB6.js +469 -0
  73. package/dist/chunk-RC6MEZB6.js.map +1 -0
  74. package/dist/chunk-RY3ZFII7.js +3440 -0
  75. package/dist/chunk-RY3ZFII7.js.map +1 -0
  76. package/dist/chunk-TAT6JU3X.js +167 -0
  77. package/dist/chunk-TAT6JU3X.js.map +1 -0
  78. package/dist/chunk-UDZIS2AQ.js +79 -0
  79. package/dist/chunk-UDZIS2AQ.js.map +1 -0
  80. package/dist/chunk-UPLBF4RZ.js +115 -0
  81. package/dist/chunk-UPLBF4RZ.js.map +1 -0
  82. package/dist/chunk-UWQTZMNI.js +154 -0
  83. package/dist/chunk-UWQTZMNI.js.map +1 -0
  84. package/dist/chunk-W4T7PGI2.js +346 -0
  85. package/dist/chunk-W4T7PGI2.js.map +1 -0
  86. package/dist/chunk-XTBKL5BI.js +111 -0
  87. package/dist/chunk-XTBKL5BI.js.map +1 -0
  88. package/dist/chunk-YIJY5DBV.js +399 -0
  89. package/dist/chunk-YIJY5DBV.js.map +1 -0
  90. package/dist/chunk-YUFNYN2H.js +242 -0
  91. package/dist/chunk-YUFNYN2H.js.map +1 -0
  92. package/dist/chunk-Z2PUCXTZ.js +94 -0
  93. package/dist/chunk-Z2PUCXTZ.js.map +1 -0
  94. package/dist/chunk-ZZJOFKAT.js +13 -0
  95. package/dist/chunk-ZZJOFKAT.js.map +1 -0
  96. package/dist/cli/index.js +3661 -0
  97. package/dist/cli/index.js.map +1 -0
  98. package/dist/config-WVMRUOCA.js +13 -0
  99. package/dist/config-WVMRUOCA.js.map +1 -0
  100. package/dist/context-loader-3ORBPMHJ.js +13 -0
  101. package/dist/context-loader-3ORBPMHJ.js.map +1 -0
  102. package/dist/conversation-QDEIDQPH.js +22 -0
  103. package/dist/conversation-QDEIDQPH.js.map +1 -0
  104. package/dist/cost-tracker-RS3W7SVY.js +24 -0
  105. package/dist/cost-tracker-RS3W7SVY.js.map +1 -0
  106. package/dist/delegate-VJCJLYEK.js +29 -0
  107. package/dist/delegate-VJCJLYEK.js.map +1 -0
  108. package/dist/emotional-state-VQVRA6ED.js +206 -0
  109. package/dist/emotional-state-VQVRA6ED.js.map +1 -0
  110. package/dist/env-discovery-2BLVMAIM.js +251 -0
  111. package/dist/env-discovery-2BLVMAIM.js.map +1 -0
  112. package/dist/export-6GCYHEHQ.js +165 -0
  113. package/dist/export-6GCYHEHQ.js.map +1 -0
  114. package/dist/graph-YUIPOSOO.js +14 -0
  115. package/dist/graph-YUIPOSOO.js.map +1 -0
  116. package/dist/harness-LCHA3DWP.js +10 -0
  117. package/dist/harness-LCHA3DWP.js.map +1 -0
  118. package/dist/harness-WE4SLCML.js +26 -0
  119. package/dist/harness-WE4SLCML.js.map +1 -0
  120. package/dist/health-NZ6WNIMV.js +23 -0
  121. package/dist/health-NZ6WNIMV.js.map +1 -0
  122. package/dist/index.d.ts +3612 -0
  123. package/dist/index.js +13501 -0
  124. package/dist/index.js.map +1 -0
  125. package/dist/indexer-LONANRRM.js +16 -0
  126. package/dist/indexer-LONANRRM.js.map +1 -0
  127. package/dist/instinct-learner-SRM72DHF.js +20 -0
  128. package/dist/instinct-learner-SRM72DHF.js.map +1 -0
  129. package/dist/intake-4M3HNU43.js +21 -0
  130. package/dist/intake-4M3HNU43.js.map +1 -0
  131. package/dist/intelligence-HJOCA4SJ.js +1081 -0
  132. package/dist/intelligence-HJOCA4SJ.js.map +1 -0
  133. package/dist/journal-WANJL3MI.js +24 -0
  134. package/dist/journal-WANJL3MI.js.map +1 -0
  135. package/dist/loader-C3TKIKZR.js +23 -0
  136. package/dist/loader-C3TKIKZR.js.map +1 -0
  137. package/dist/mcp-WTQJJZAO.js +15 -0
  138. package/dist/mcp-WTQJJZAO.js.map +1 -0
  139. package/dist/mcp-discovery-WPAQFL6S.js +377 -0
  140. package/dist/mcp-discovery-WPAQFL6S.js.map +1 -0
  141. package/dist/mcp-installer-6O2XXD3V.js +394 -0
  142. package/dist/mcp-installer-6O2XXD3V.js.map +1 -0
  143. package/dist/metrics-KXGNFAAB.js +20 -0
  144. package/dist/metrics-KXGNFAAB.js.map +1 -0
  145. package/dist/primitive-registry-I6VTIR4W.js +512 -0
  146. package/dist/primitive-registry-I6VTIR4W.js.map +1 -0
  147. package/dist/project-discovery-C4UMD7JI.js +246 -0
  148. package/dist/project-discovery-C4UMD7JI.js.map +1 -0
  149. package/dist/provider-LQHQX7Z7.js +26 -0
  150. package/dist/provider-LQHQX7Z7.js.map +1 -0
  151. package/dist/provider-SXPQZ74H.js +28 -0
  152. package/dist/provider-SXPQZ74H.js.map +1 -0
  153. package/dist/rate-limiter-RLRVM325.js +22 -0
  154. package/dist/rate-limiter-RLRVM325.js.map +1 -0
  155. package/dist/rule-engine-YGQ3RYZM.js +182 -0
  156. package/dist/rule-engine-YGQ3RYZM.js.map +1 -0
  157. package/dist/scaffold-A3VRRCBV.js +347 -0
  158. package/dist/scaffold-A3VRRCBV.js.map +1 -0
  159. package/dist/scheduler-XHHIVHRI.js +397 -0
  160. package/dist/scheduler-XHHIVHRI.js.map +1 -0
  161. package/dist/search-V3W5JMJG.js +75 -0
  162. package/dist/search-V3W5JMJG.js.map +1 -0
  163. package/dist/semantic-search-2DTOO5UX.js +241 -0
  164. package/dist/semantic-search-2DTOO5UX.js.map +1 -0
  165. package/dist/serve-DTQ3HENY.js +291 -0
  166. package/dist/serve-DTQ3HENY.js.map +1 -0
  167. package/dist/sessions-CZGVXKQE.js +21 -0
  168. package/dist/sessions-CZGVXKQE.js.map +1 -0
  169. package/dist/sources-RW5DT56F.js +32 -0
  170. package/dist/sources-RW5DT56F.js.map +1 -0
  171. package/dist/starter-packs-76YUVHEU.js +893 -0
  172. package/dist/starter-packs-76YUVHEU.js.map +1 -0
  173. package/dist/state-GMXILIHW.js +13 -0
  174. package/dist/state-GMXILIHW.js.map +1 -0
  175. package/dist/state-merge-NKO5FRBA.js +174 -0
  176. package/dist/state-merge-NKO5FRBA.js.map +1 -0
  177. package/dist/telemetry-UC6PBXC7.js +22 -0
  178. package/dist/telemetry-UC6PBXC7.js.map +1 -0
  179. package/dist/tool-executor-MJ7IG7PQ.js +28 -0
  180. package/dist/tool-executor-MJ7IG7PQ.js.map +1 -0
  181. package/dist/tools-DZ4KETET.js +20 -0
  182. package/dist/tools-DZ4KETET.js.map +1 -0
  183. package/dist/types-EW7AIB3R.js +18 -0
  184. package/dist/types-EW7AIB3R.js.map +1 -0
  185. package/dist/types-WGDLSPO6.js +16 -0
  186. package/dist/types-WGDLSPO6.js.map +1 -0
  187. package/dist/universal-installer-QGS4SJGX.js +578 -0
  188. package/dist/universal-installer-QGS4SJGX.js.map +1 -0
  189. package/dist/validator-7WXMDIHH.js +22 -0
  190. package/dist/validator-7WXMDIHH.js.map +1 -0
  191. package/dist/verification-gate-FYXUX6LH.js +246 -0
  192. package/dist/verification-gate-FYXUX6LH.js.map +1 -0
  193. package/dist/versioning-Z3XNE2Q2.js +271 -0
  194. package/dist/versioning-Z3XNE2Q2.js.map +1 -0
  195. package/dist/watcher-ISJC7YKL.js +109 -0
  196. package/dist/watcher-ISJC7YKL.js.map +1 -0
  197. package/dist/web-server-DD7ZOP46.js +28 -0
  198. package/dist/web-server-DD7ZOP46.js.map +1 -0
  199. package/package.json +76 -0
  200. package/sources.yaml +121 -0
  201. package/templates/assistant/CORE.md +24 -0
  202. package/templates/assistant/SYSTEM.md +24 -0
  203. package/templates/assistant/config.yaml +51 -0
  204. package/templates/base/CORE.md +17 -0
  205. package/templates/base/SYSTEM.md +24 -0
  206. package/templates/base/config.yaml +51 -0
  207. package/templates/claude-opus/config.yaml +51 -0
  208. package/templates/code-reviewer/CORE.md +25 -0
  209. package/templates/code-reviewer/SYSTEM.md +30 -0
  210. package/templates/code-reviewer/config.yaml +51 -0
  211. package/templates/gpt4/config.yaml +51 -0
  212. package/templates/local/config.yaml +51 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Randy Wilson
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/NOTICE ADDED
@@ -0,0 +1,41 @@
1
+ agent-harness
2
+ Copyright (c) 2026 Randy Wilson
3
+
4
+ This product includes content redistributed under third-party licenses.
5
+
6
+ ================================================================================
7
+ wshobson/agents
8
+ ================================================================================
9
+
10
+ The following files in defaults/skills/ are adapted from wshobson/agents and
11
+ are licensed under the MIT License:
12
+
13
+ - defaults/skills/content-marketer.md
14
+ (plugins/content-marketing/agents/content-marketer.md)
15
+
16
+ - defaults/skills/business-analyst.md
17
+ (plugins/business-analytics/agents/business-analyst.md)
18
+
19
+ Source: https://github.com/wshobson/agents
20
+
21
+ MIT License
22
+
23
+ Copyright (c) 2024 Seth Hobson
24
+
25
+ Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ of this software and associated documentation files (the "Software"), to deal
27
+ in the Software without restriction, including without limitation the rights
28
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ copies of the Software, and to permit persons to whom the Software is
30
+ furnished to do so, subject to the following conditions:
31
+
32
+ The above copyright notice and this permission notice shall be included in all
33
+ copies or substantial portions of the Software.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,445 @@
1
+ # Agent Harness
2
+
3
+ > **The first agent framework where the agent gets measurably better as you use it. You write markdown, not code. Tools come from MCP.**
4
+
5
+ Agent Harness is a file-first framework for building agents by editing markdown. It's designed for anyone who wants to build an agent in 2026 — coder or non-coder — and its differentiator is a built-in learning loop: every interaction is journaled, patterns become instincts, and the agent improves without retraining or fine-tuning.
6
+
7
+ The code layer exists as an escape hatch, not the entry point. The folder IS the agent.
8
+
9
+ ## Why this is different
10
+
11
+ - **Self-learning by default**: every interaction is journaled, patterns become instincts, agents get measurably better with use — no retraining, no fine-tuning.
12
+ - **File-first authoring**: edit markdown, not code. The folder IS the agent.
13
+ - **MCP-native tools**: the entire MCP ecosystem is your toolbox. No custom adapter layer.
14
+
15
+ ## Quick Start
16
+
17
+ ```bash
18
+ # Install globally
19
+ npm install -g @agntk/agent-harness
20
+
21
+ # Create a new agent
22
+ harness init my-agent
23
+ cd my-agent
24
+
25
+ # Set your API key
26
+ export OPENROUTER_API_KEY=sk-or-...
27
+
28
+ # Ask your agent to do something useful
29
+ harness run "Help me decide between two options: A or B"
30
+
31
+ # Or start an interactive chat
32
+ harness chat
33
+
34
+ # See what's loaded
35
+ harness info
36
+
37
+ # Watch for file changes
38
+ harness dev
39
+ ```
40
+
41
+ ## The Learning Loop
42
+
43
+ Agent Harness agents learn from experience through an automated pipeline:
44
+
45
+ ```
46
+ Interaction → Session recorded → Journal synthesized → Instincts proposed → Auto-installed
47
+ ```
48
+
49
+ 1. Every interaction is saved as a **session** in `memory/sessions/`
50
+ 2. Run `harness journal` to synthesize sessions into a daily **journal** entry
51
+ 3. Run `harness learn --install` to detect behavioral patterns and install new **instincts**
52
+ 4. On the next run, the agent loads its new instincts and behaves differently
53
+
54
+ This means your agent gets better over time — without you writing any code.
55
+
56
+ ## How It Works
57
+
58
+ When you run `harness init my-agent`, you get this directory:
59
+
60
+ ```
61
+ my-agent/
62
+ ├── CORE.md # Agent identity (frozen — who am I?)
63
+ ├── SYSTEM.md # Boot instructions (how do I operate?)
64
+ ├── config.yaml # Model, runtime, memory settings
65
+ ├── state.md # Live state (mode, goals, last interaction)
66
+ ├── rules/ # Human-authored operational boundaries
67
+ │ └── operations.md
68
+ ├── instincts/ # Agent-learned reflexive behaviors
69
+ │ ├── lead-with-answer.md
70
+ │ ├── read-before-edit.md
71
+ │ └── search-before-create.md
72
+ ├── skills/ # Capabilities with embedded expertise
73
+ │ └── research.md
74
+ ├── playbooks/ # Adaptive guidance for outcomes
75
+ │ └── ship-feature.md
76
+ ├── workflows/ # Cron-driven automations
77
+ ├── tools/ # External service integrations
78
+ ├── agents/ # Sub-agent roster
79
+ └── memory/
80
+ ├── sessions/ # Auto-captured interaction records
81
+ ├── journal/ # Daily synthesized reflections
82
+ └── scratch.md # Ephemeral working memory
83
+ ```
84
+
85
+ Every file is markdown with YAML frontmatter. Every file has three disclosure levels:
86
+
87
+ - **L0** (~5 tokens): One-line summary in an HTML comment
88
+ - **L1** (~50-100 tokens): Paragraph summary in an HTML comment
89
+ - **L2** (full body): Complete content
90
+
91
+ The harness loads files intelligently based on token budget — L0 to decide relevance, L1 to work with, L2 only when actively needed.
92
+
93
+ ## The 7 Primitives
94
+
95
+ | Primitive | Owner | Purpose | Example |
96
+ |-----------|-------|---------|---------|
97
+ | **Rules** | Human | Operational boundaries that don't change | "Never deploy on Fridays" |
98
+ | **Instincts** | Agent | Learned behaviors that evolve over time | "Lead with the answer, not reasoning" |
99
+ | **Skills** | Mixed | Capabilities with embedded judgment | "How to do research" |
100
+ | **Playbooks** | Mixed | Adaptive guidance for achieving outcomes | "How to ship a feature" |
101
+ | **Workflows** | Infra | Cron-driven deterministic automations | "Hourly health check" |
102
+ | **Tools** | External | Service integration knowledge | "GitHub API patterns" |
103
+ | **Agents** | External | Sub-agent roster and capabilities | "Code reviewer agent" |
104
+
105
+ ### Ownership matters
106
+
107
+ Every file has exactly one owner — human, agent, or infrastructure:
108
+
109
+ - **Human** writes rules and CORE.md. The agent respects these.
110
+ - **Agent** writes instincts and sessions. It learns from experience.
111
+ - **Infrastructure** writes indexes and journals. Bookkeeping is automated.
112
+
113
+ ## Customizing Your Agent
114
+
115
+ ### Change identity
116
+ Edit `CORE.md` — this is who your agent is, its values, and its ethics.
117
+
118
+ ### Add a rule
119
+ Create a file in `rules/`:
120
+
121
+ ```markdown
122
+ ---
123
+ id: no-friday-deploys
124
+ tags: [rule, safety, deployment]
125
+ created: 2026-04-06
126
+ author: human
127
+ status: active
128
+ ---
129
+
130
+ <!-- L0: Never deploy to production on Fridays. -->
131
+ <!-- L1: No production deployments on Fridays. Three incidents were traced to Friday
132
+ deploys with reduced weekend monitoring. Staging is fine. -->
133
+
134
+ # Rule: No Friday Deploys
135
+
136
+ Never deploy to production on Fridays. Staging deployments are acceptable.
137
+ If an emergency hotfix is needed, require explicit human approval.
138
+ ```
139
+
140
+ ### Add an instinct
141
+ Create a file in `instincts/`. Instincts are behaviors the agent learns — they have provenance (where the learning came from).
142
+
143
+ ### Add a skill
144
+ Create a file in `skills/`. Skills include not just what the agent can do, but how it thinks about doing it — judgment, red flags, when NOT to use the skill.
145
+
146
+ ### Add a playbook
147
+ Create a file in `playbooks/`. Playbooks are step-by-step guidance that the agent interprets and adapts, not rigid scripts.
148
+
149
+ ## Installing Content
150
+
151
+ Install skills, rules, agents, and more from the community:
152
+
153
+ ```bash
154
+ # Install from any source — file, URL, or name
155
+ harness install https://raw.githubusercontent.com/.../skill.md
156
+
157
+ # Search community sources
158
+ harness discover search "code review"
159
+
160
+ # Browse available sources
161
+ harness sources list
162
+ ```
163
+
164
+ The installer auto-detects format (Claude Code skills, raw markdown, bash hooks, MCP configs) and normalizes to harness convention with proper frontmatter.
165
+
166
+ Share your own primitives as bundles:
167
+
168
+ ```bash
169
+ harness bundle my-skills.tar --types skills,rules
170
+ harness bundle-install my-skills.tar
171
+ ```
172
+
173
+ ## CLI Commands
174
+
175
+ ### Core
176
+
177
+ | Command | Description |
178
+ |---------|-------------|
179
+ | `harness init [name]` | Create a new agent (interactive if no name given) |
180
+ | `harness run <prompt>` | Run a single prompt |
181
+ | `harness run <prompt> --stream` | Stream the response |
182
+ | `harness run <prompt> -m claude` | Use a model alias |
183
+ | `harness chat` | Interactive REPL with conversation memory |
184
+ | `harness chat --fresh` | Start a fresh conversation (clear history) |
185
+ | `harness info` | Show loaded context and token budget |
186
+ | `harness prompt` | Display the full assembled system prompt |
187
+ | `harness status` | Show primitives, sessions, config, state |
188
+ | `harness validate` | Validate harness structure and configuration |
189
+ | `harness doctor` | Validate and auto-fix all fixable issues |
190
+
191
+ ### Development
192
+
193
+ | Command | Description |
194
+ |---------|-------------|
195
+ | `harness dev` | Watch mode + auto-index + scheduler + web dashboard |
196
+ | `harness dev --port 8080` | Custom dashboard port (default 3000) |
197
+ | `harness index` | Rebuild all index files |
198
+ | `harness process` | Auto-fill missing frontmatter and L0/L1 summaries |
199
+ | `harness search <query>` | Search primitives by text and tags |
200
+ | `harness graph` | Analyze primitive dependency graph |
201
+ | `harness serve` | Start HTTP API server for webhooks and integrations |
202
+
203
+ ### Learning
204
+
205
+ | Command | Description |
206
+ |---------|-------------|
207
+ | `harness journal` | Synthesize today's sessions into a journal entry |
208
+ | `harness learn` | Analyze sessions and propose new instincts |
209
+ | `harness learn --install` | Auto-install proposed instincts |
210
+ | `harness harvest --install` | Extract and install instinct candidates from journals |
211
+ | `harness auto-promote` | Promote instinct patterns appearing 3+ times |
212
+
213
+ ### Intelligence
214
+
215
+ | Command | Description |
216
+ |---------|-------------|
217
+ | `harness suggest` | Suggest skills/playbooks for frequent uncovered topics |
218
+ | `harness contradictions` | Detect conflicts between rules and instincts |
219
+ | `harness dead-primitives` | Find orphaned primitives not used in 30+ days |
220
+ | `harness enrich` | Add topics, token counts, and references to sessions |
221
+ | `harness gate run` | Run verification gates (pre-boot, pre-run, post-session, pre-deploy) |
222
+ | `harness check-rules <action>` | Check an action against loaded rules |
223
+
224
+ ### MCP (Model Context Protocol)
225
+
226
+ | Command | Description |
227
+ |---------|-------------|
228
+ | `harness mcp list` | List configured MCP servers and status |
229
+ | `harness mcp test` | Test server connections and list tools |
230
+ | `harness mcp discover` | Scan for servers from Claude Desktop, Cursor, VS Code, etc. |
231
+ | `harness mcp search <query>` | Search the MCP registry |
232
+ | `harness mcp install <query>` | Install an MCP server from the registry |
233
+
234
+ ### Installing and Sharing
235
+
236
+ | Command | Description |
237
+ |---------|-------------|
238
+ | `harness install <source>` | Install from file, URL, or source name (auto-detects format) |
239
+ | `harness discover search <query>` | Search all community sources for content |
240
+ | `harness discover env` | Scan .env files for API keys, suggest MCP servers |
241
+ | `harness discover project` | Detect tech stack, suggest rules/skills |
242
+ | `harness bundle <output>` | Pack primitives into a shareable bundle |
243
+ | `harness bundle-install <source>` | Install from a bundle |
244
+ | `harness export [output]` | Export harness to a portable JSON bundle |
245
+ | `harness import <bundle>` | Import a harness bundle |
246
+ | `harness sources list` | List configured community content sources |
247
+
248
+ ### Monitoring
249
+
250
+ | Command | Description |
251
+ |---------|-------------|
252
+ | `harness dashboard` | Unified view of health, costs, sessions, workflows |
253
+ | `harness health` | System health status and metrics |
254
+ | `harness costs` | View API spending |
255
+ | `harness analytics` | Session analytics and usage patterns |
256
+ | `harness metrics` | Workflow execution metrics |
257
+
258
+ ### Model Aliases
259
+
260
+ Use `-m` with a shorthand instead of full OpenRouter model IDs:
261
+
262
+ | Alias | Model |
263
+ |-------|-------|
264
+ | `gemma` | google/gemma-4-26b-a4b-it |
265
+ | `gemma-31b` | google/gemma-4-31b-it |
266
+ | `qwen` | qwen/qwen3.5-35b-a3b |
267
+ | `glm` | z-ai/glm-4.7-flash |
268
+ | `claude` | anthropic/claude-sonnet-4 |
269
+ | `gpt4o` | openai/gpt-4o |
270
+
271
+ ## Tools
272
+
273
+ Agent Harness uses three tool layers, in priority order:
274
+
275
+ 1. **MCP servers** — the primary tool layer. Anything an agent reaches beyond its own files comes from an MCP server: web search, browsers, databases, file systems, code execution. Search the registry with `harness mcp search <query>` or detect what's already on your machine with `harness mcp discover`.
276
+
277
+ 2. **Markdown HTTP tools** — for trivial REST APIs where spinning up an MCP server is overkill. Drop a markdown file in `tools/` with frontmatter, an `## Authentication` section, and an `## Operations` section. The harness's HTTP executor calls them directly.
278
+
279
+ 3. **Programmatic tools** — escape hatch. For latency-critical or harness-internal access where you need a real JS function. Register via `defineAgent().withTool(...)`.
280
+
281
+ You almost always want option 1.
282
+
283
+ ## MCP Integration
284
+
285
+ Agent Harness connects to [MCP servers](https://modelcontextprotocol.io/) to give your agent tools — file access, APIs, databases, and more.
286
+
287
+ ```yaml
288
+ # config.yaml
289
+ mcp:
290
+ servers:
291
+ filesystem:
292
+ transport: stdio
293
+ command: npx
294
+ args: ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
295
+ my-api:
296
+ transport: http
297
+ url: https://example.com/mcp
298
+ ```
299
+
300
+ Auto-discover servers already on your machine:
301
+
302
+ ```bash
303
+ harness mcp discover # Scans Claude Desktop, Cursor, VS Code, Cline, etc.
304
+ harness mcp search github # Search the MCP registry
305
+ harness mcp install github # Install from registry into config.yaml
306
+ ```
307
+
308
+ During `harness init`, MCP servers are auto-discovered and added to your config.
309
+
310
+ ## Dev Mode and Dashboard
311
+
312
+ `harness dev` starts everything at once:
313
+
314
+ - **File watcher** — auto-rebuilds indexes when you edit primitives
315
+ - **Auto-processor** — fills missing frontmatter and L0/L1 summaries on save
316
+ - **Scheduler** — runs cron-based workflows
317
+ - **Web dashboard** — browse primitives, chat, view sessions at `localhost:3000`
318
+
319
+ ```bash
320
+ harness dev # Start everything
321
+ harness dev --port 8080 # Custom port
322
+ harness dev --no-web # Skip dashboard
323
+ harness dev --no-auto-process # Skip auto-processing
324
+ ```
325
+
326
+ The dashboard includes: agent status, health checks, spending, sessions, workflows, primitives browser, file editor, MCP status, settings editor, and a chat interface.
327
+
328
+ ## Using as a Library
329
+
330
+ ```typescript
331
+ import { createHarness } from '@agntk/agent-harness';
332
+
333
+ const agent = createHarness({
334
+ dir: './my-agent',
335
+ apiKey: process.env.OPENROUTER_API_KEY,
336
+ });
337
+
338
+ await agent.boot();
339
+
340
+ // One-shot
341
+ const result = await agent.run('What should I work on today?');
342
+ console.log(result.text);
343
+
344
+ // Streaming
345
+ for await (const chunk of agent.stream('Explain this codebase')) {
346
+ process.stdout.write(chunk);
347
+ }
348
+
349
+ await agent.shutdown();
350
+ ```
351
+
352
+ ### Fluent Builder API
353
+
354
+ ```typescript
355
+ import { defineAgent } from '@agntk/agent-harness';
356
+
357
+ const agent = defineAgent('./my-agent')
358
+ .model('anthropic/claude-sonnet-4')
359
+ .provider('openrouter')
360
+ .onBoot(({ config }) => console.log(`Booted ${config.agent.name}`))
361
+ .onError(({ error }) => console.error(error))
362
+ .build();
363
+ ```
364
+
365
+ ## Configuration
366
+
367
+ `config.yaml`:
368
+
369
+ ```yaml
370
+ agent:
371
+ name: my-agent
372
+ version: "0.1.0"
373
+
374
+ model:
375
+ provider: openrouter # openrouter | anthropic | openai
376
+ id: anthropic/claude-sonnet-4 # Any model ID for your provider
377
+ max_tokens: 200000
378
+ # summary_model: google/gemma-4-26b-a4b-it # Cheap model for auto-generation
379
+ # fast_model: google/gemma-4-26b-a4b-it # Fast model for validation
380
+
381
+ runtime:
382
+ scratchpad_budget: 10000
383
+ timezone: America/New_York
384
+ auto_process: true # Auto-fill frontmatter/summaries on file changes
385
+
386
+ memory:
387
+ session_retention_days: 7
388
+ journal_retention_days: 365
389
+
390
+ # rate_limits:
391
+ # per_minute: 10
392
+ # per_hour: 100
393
+ # per_day: 500
394
+
395
+ # budget:
396
+ # daily_limit_usd: 5.00
397
+ # monthly_limit_usd: 100.00
398
+ # enforce: true
399
+ ```
400
+
401
+ ## Environment Variables
402
+
403
+ | Variable | Required | Description |
404
+ |----------|----------|-------------|
405
+ | `OPENROUTER_API_KEY` | For OpenRouter | Your OpenRouter API key |
406
+ | `ANTHROPIC_API_KEY` | For Anthropic | Direct Anthropic API key |
407
+ | `OPENAI_API_KEY` | For OpenAI | Direct OpenAI API key |
408
+
409
+ Set one based on your `model.provider` in config.yaml. The `.env` file in your harness directory is auto-loaded.
410
+
411
+ ## How Context Loading Works
412
+
413
+ On every run, the harness:
414
+
415
+ 1. Loads **CORE.md** (always, full content)
416
+ 2. Loads **state.md** (current goals and mode)
417
+ 3. Loads **SYSTEM.md** (boot instructions)
418
+ 4. Scans all primitive directories, loading files at the appropriate disclosure level based on remaining token budget
419
+ 5. Loads **scratch.md** if it has content
420
+
421
+ Total harness overhead is typically ~1,000-3,000 tokens depending on how many primitives you have.
422
+
423
+ ## Tested Models
424
+
425
+ These local-capable models work well with the harness via OpenRouter:
426
+
427
+ | Model | Speed | Quality | Best For |
428
+ |-------|-------|---------|----------|
429
+ | google/gemma-4-26b-a4b-it | Fast (2s) | Excellent | Default local model |
430
+ | google/gemma-4-31b-it | Medium (8s) | Good | Complex reasoning |
431
+ | qwen/qwen3.5-35b-a3b | Slow (30s) | Good | Very concise responses |
432
+ | z-ai/glm-4.7-flash | Fast (5s) | Good | Natural conversation |
433
+
434
+ ## Philosophy
435
+
436
+ - **The agent is the filesystem.** Not the code.
437
+ - **Ownership is law.** Every file has exactly one owner.
438
+ - **You shouldn't need to write code to build a capable agent.** But you can.
439
+ - **Progressive disclosure.** Load what you need, at the level you need.
440
+ - **Agents learn.** Instincts evolve. Sessions become journals.
441
+ - **Infrastructure does bookkeeping.** The agent does thinking.
442
+
443
+ ## License
444
+
445
+ MIT
@@ -0,0 +1,49 @@
1
+ ---
2
+ id: agent-summarizer
3
+ tags: [agent, utility, stateless]
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ author: human
7
+ status: active
8
+ related:
9
+ - research
10
+ ---
11
+
12
+ <!-- L0: Stateless summarizer agent — condenses long text into structured summaries. -->
13
+ <!-- L1: Takes long-form input (documents, transcripts, logs) and produces structured summaries
14
+ with key points, action items, and decisions. Follows a consistent output format.
15
+ Cannot access external services or modify files. -->
16
+
17
+ # Agent: Summarizer
18
+
19
+ ## Identity
20
+ You are a stateless summarizer agent. You produce structured summaries of input text.
21
+ You do not have memory or state between calls.
22
+
23
+ ## Purpose
24
+ Condense long-form input into structured, actionable summaries.
25
+
26
+ ## Capabilities
27
+ - Extract key points from documents, transcripts, and logs
28
+ - Identify action items and decisions
29
+ - Produce consistent structured output
30
+
31
+ ## Output Format
32
+ Always respond with this structure:
33
+
34
+ ### Summary
35
+ (2-3 sentence overview)
36
+
37
+ ### Key Points
38
+ - (bulleted list of important points)
39
+
40
+ ### Action Items
41
+ - (any action items found, or "None identified")
42
+
43
+ ### Decisions
44
+ - (any decisions made, or "None identified")
45
+
46
+ ## Constraints
47
+ - Never fabricate information not present in the input
48
+ - Never access external services
49
+ - If the input is too short to summarize, say so
@@ -0,0 +1,24 @@
1
+ ---
2
+ id: lead-with-answer
3
+ tags: [instinct, communication]
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ author: agent
7
+ status: active
8
+ source: learned-behavior
9
+ related:
10
+ - respect-the-user
11
+ ---
12
+
13
+ <!-- L0: Always lead with the answer, not the reasoning. -->
14
+ <!-- L1: When responding to questions, put the answer first. Context and reasoning come after.
15
+ This respects the reader's time and attention. Avoid preamble like "Great question!" -->
16
+
17
+ # Instinct: Lead With Answer
18
+
19
+ When someone asks a question, answer it first. Then explain if needed.
20
+
21
+ **Wrong:** "That's a great question. Let me think about the various factors..."
22
+ **Right:** "Use Redis. Here's why..."
23
+
24
+ Provenance: Learned from repeated feedback about verbose responses.
@@ -0,0 +1,40 @@
1
+ ---
2
+ id: qualify-before-recommending
3
+ tags: [instinct, communication, recommendations]
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ author: agent
7
+ status: active
8
+ source: default
9
+ related:
10
+ - ask-before-assuming
11
+ ---
12
+
13
+ <!-- L0: Before recommending anything, identify what context is missing that would change the answer. -->
14
+ <!-- L1: A good recommendation requires knowing the constraints. When asked "what should I use for X?"
15
+ the honest first move is to name the variables that determine the answer: budget, scale, team
16
+ skill, existing stack, time horizon. Qualify first, recommend second. See [ask-before-assuming]. -->
17
+
18
+ # Instinct: Qualify Before Recommending
19
+
20
+ When the user asks for a recommendation without giving constraints, the reflex is to name the
21
+ missing variables — not to default to a generic best-in-class answer that may not fit them.
22
+
23
+ ## The move
24
+ 1. Identify the 2-3 constraints that would most change the recommendation.
25
+ 2. Ask about the most load-bearing one, or state an assumption and proceed.
26
+ 3. Never give a generic "popular choice" answer as if it fits every context.
27
+
28
+ ## Examples of load-bearing constraints
29
+ - Budget / free-vs-paid
30
+ - Scale (10 users vs 10M)
31
+ - Existing stack / lock-in cost
32
+ - Team's current skill set
33
+ - Time horizon (prototype vs decade-long system)
34
+
35
+ ## When to skip qualifying
36
+ - The user already gave the constraints.
37
+ - The answer is the same across all plausible contexts.
38
+ - The user explicitly asked for "your favorite" or "your default" — then just answer.
39
+
40
+ Related: [ask-before-assuming]
@@ -0,0 +1,23 @@
1
+ ---
2
+ id: read-before-edit
3
+ tags: [instinct, development]
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ author: agent
7
+ status: active
8
+ source: learned-behavior
9
+ related:
10
+ - search-before-create
11
+ ---
12
+
13
+ <!-- L0: Always read a file before editing it. -->
14
+ <!-- L1: Never propose changes to code you haven't read. Understanding existing patterns
15
+ prevents breaking changes and respects prior work. Read the full file, understand the
16
+ context, then edit. -->
17
+
18
+ # Instinct: Read Before Edit
19
+
20
+ Always read a file completely before modifying it. Understand existing patterns,
21
+ naming conventions, and architecture before making changes.
22
+
23
+ Provenance: Multiple incidents where blind edits broke existing functionality.
@@ -0,0 +1,23 @@
1
+ ---
2
+ id: search-before-create
3
+ tags: [instinct, development, reuse]
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ author: agent
7
+ status: active
8
+ source: learned-behavior
9
+ related:
10
+ - read-before-edit
11
+ ---
12
+
13
+ <!-- L0: Search for existing solutions before creating new ones. -->
14
+ <!-- L1: Before writing new code, search the codebase for existing implementations.
15
+ Reuse is almost always better than duplication. Check utilities, helpers, and
16
+ similar patterns before building from scratch. -->
17
+
18
+ # Instinct: Search Before Create
19
+
20
+ Before creating anything new — a function, a file, a module — search for existing
21
+ implementations first. Duplication creates maintenance burden. Reuse creates leverage.
22
+
23
+ Provenance: Found duplicate utility functions across three separate modules.