@fabriccode/weave 0.7.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 (120) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +309 -0
  3. package/dist/agents/agent-builder.d.ts +24 -0
  4. package/dist/agents/builtin-agents.d.ts +32 -0
  5. package/dist/agents/custom-agent-factory.d.ts +24 -0
  6. package/dist/agents/dynamic-prompt-builder.d.ts +35 -0
  7. package/dist/agents/index.d.ts +12 -0
  8. package/dist/agents/loom/default.d.ts +2 -0
  9. package/dist/agents/loom/index.d.ts +11 -0
  10. package/dist/agents/loom/prompt-composer.d.ts +35 -0
  11. package/dist/agents/model-resolution.d.ts +27 -0
  12. package/dist/agents/pattern/default.d.ts +2 -0
  13. package/dist/agents/pattern/index.d.ts +2 -0
  14. package/dist/agents/prompt-loader.d.ts +9 -0
  15. package/dist/agents/prompt-utils.d.ts +2 -0
  16. package/dist/agents/shuttle/default.d.ts +2 -0
  17. package/dist/agents/shuttle/index.d.ts +2 -0
  18. package/dist/agents/spindle/default.d.ts +2 -0
  19. package/dist/agents/spindle/index.d.ts +2 -0
  20. package/dist/agents/tapestry/default.d.ts +2 -0
  21. package/dist/agents/tapestry/index.d.ts +9 -0
  22. package/dist/agents/tapestry/prompt-composer.d.ts +24 -0
  23. package/dist/agents/thread/default.d.ts +2 -0
  24. package/dist/agents/thread/index.d.ts +2 -0
  25. package/dist/agents/types.d.ts +82 -0
  26. package/dist/agents/warp/default.d.ts +2 -0
  27. package/dist/agents/warp/index.d.ts +2 -0
  28. package/dist/agents/weft/default.d.ts +2 -0
  29. package/dist/agents/weft/index.d.ts +2 -0
  30. package/dist/config/index.d.ts +3 -0
  31. package/dist/config/loader.d.ts +2 -0
  32. package/dist/config/merge.d.ts +3 -0
  33. package/dist/config/schema.d.ts +274 -0
  34. package/dist/create-managers.d.ts +21 -0
  35. package/dist/create-tools.d.ts +16 -0
  36. package/dist/features/analytics/adherence.d.ts +10 -0
  37. package/dist/features/analytics/fingerprint.d.ts +33 -0
  38. package/dist/features/analytics/format-metrics.d.ts +10 -0
  39. package/dist/features/analytics/generate-metrics-report.d.ts +17 -0
  40. package/dist/features/analytics/git-diff.d.ts +7 -0
  41. package/dist/features/analytics/index.d.ts +29 -0
  42. package/dist/features/analytics/plan-parser.d.ts +7 -0
  43. package/dist/features/analytics/plan-token-aggregator.d.ts +11 -0
  44. package/dist/features/analytics/session-tracker.d.ts +68 -0
  45. package/dist/features/analytics/storage.d.ts +40 -0
  46. package/dist/features/analytics/suggestions.d.ts +10 -0
  47. package/dist/features/analytics/token-report.d.ts +14 -0
  48. package/dist/features/analytics/types.d.ts +194 -0
  49. package/dist/features/builtin-commands/commands.d.ts +2 -0
  50. package/dist/features/builtin-commands/index.d.ts +2 -0
  51. package/dist/features/builtin-commands/templates/metrics.d.ts +1 -0
  52. package/dist/features/builtin-commands/templates/run-workflow.d.ts +1 -0
  53. package/dist/features/builtin-commands/templates/start-work.d.ts +1 -0
  54. package/dist/features/builtin-commands/types.d.ts +16 -0
  55. package/dist/features/evals/baseline.d.ts +4 -0
  56. package/dist/features/evals/evaluators/deterministic.d.ts +2 -0
  57. package/dist/features/evals/evaluators/llm-judge.d.ts +2 -0
  58. package/dist/features/evals/executors/model-response.d.ts +2 -0
  59. package/dist/features/evals/executors/prompt-renderer.d.ts +2 -0
  60. package/dist/features/evals/index.d.ts +24 -0
  61. package/dist/features/evals/loader.d.ts +8 -0
  62. package/dist/features/evals/reporter.d.ts +2 -0
  63. package/dist/features/evals/runner.d.ts +7 -0
  64. package/dist/features/evals/schema.d.ts +478 -0
  65. package/dist/features/evals/storage.d.ts +7 -0
  66. package/dist/features/evals/targets/builtin-agent-target.d.ts +2 -0
  67. package/dist/features/evals/types.d.ts +223 -0
  68. package/dist/features/skill-loader/discovery.d.ts +12 -0
  69. package/dist/features/skill-loader/fabric-client.d.ts +2 -0
  70. package/dist/features/skill-loader/index.d.ts +6 -0
  71. package/dist/features/skill-loader/loader.d.ts +7 -0
  72. package/dist/features/skill-loader/resolver.d.ts +6 -0
  73. package/dist/features/skill-loader/types.d.ts +18 -0
  74. package/dist/features/work-state/constants.d.ts +8 -0
  75. package/dist/features/work-state/index.d.ts +5 -0
  76. package/dist/features/work-state/storage.d.ts +53 -0
  77. package/dist/features/work-state/types.d.ts +35 -0
  78. package/dist/features/work-state/validation-types.d.ts +26 -0
  79. package/dist/features/work-state/validation.d.ts +9 -0
  80. package/dist/features/workflow/commands.d.ts +17 -0
  81. package/dist/features/workflow/completion.d.ts +31 -0
  82. package/dist/features/workflow/constants.d.ts +12 -0
  83. package/dist/features/workflow/context.d.ts +16 -0
  84. package/dist/features/workflow/discovery.d.ts +19 -0
  85. package/dist/features/workflow/engine.d.ts +49 -0
  86. package/dist/features/workflow/hook.d.ts +47 -0
  87. package/dist/features/workflow/index.d.ts +15 -0
  88. package/dist/features/workflow/schema.d.ts +118 -0
  89. package/dist/features/workflow/storage.d.ts +51 -0
  90. package/dist/features/workflow/types.d.ts +142 -0
  91. package/dist/hooks/context-window-monitor.d.ts +19 -0
  92. package/dist/hooks/create-hooks.d.ts +40 -0
  93. package/dist/hooks/first-message-variant.d.ts +5 -0
  94. package/dist/hooks/index.d.ts +14 -0
  95. package/dist/hooks/keyword-detector.d.ts +8 -0
  96. package/dist/hooks/pattern-md-only.d.ts +13 -0
  97. package/dist/hooks/rules-injector.d.ts +6 -0
  98. package/dist/hooks/session-token-state.d.ts +42 -0
  99. package/dist/hooks/start-work-hook.d.ts +25 -0
  100. package/dist/hooks/verification-reminder.d.ts +22 -0
  101. package/dist/hooks/work-continuation.d.ts +26 -0
  102. package/dist/hooks/write-existing-file-guard.d.ts +14 -0
  103. package/dist/index.d.ts +5 -0
  104. package/dist/index.js +5585 -0
  105. package/dist/managers/background-manager.d.ts +88 -0
  106. package/dist/managers/config-handler.d.ts +54 -0
  107. package/dist/managers/index.d.ts +6 -0
  108. package/dist/managers/skill-mcp-manager.d.ts +30 -0
  109. package/dist/plugin/index.d.ts +1 -0
  110. package/dist/plugin/plugin-interface.d.ts +17 -0
  111. package/dist/plugin/types.d.ts +5 -0
  112. package/dist/shared/agent-display-names.d.ts +31 -0
  113. package/dist/shared/index.d.ts +5 -0
  114. package/dist/shared/log.d.ts +11 -0
  115. package/dist/shared/types.d.ts +6 -0
  116. package/dist/shared/version.d.ts +5 -0
  117. package/dist/tools/index.d.ts +4 -0
  118. package/dist/tools/permissions.d.ts +18 -0
  119. package/dist/tools/registry.d.ts +29 -0
  120. package/package.json +55 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Weave
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,309 @@
1
+ <p align="center">
2
+ <img src="assets/fabric_logo.png" alt="Fabric" width="400">
3
+ </p>
4
+
5
+ # Weave
6
+
7
+ Weave is a lean Fabric plugin with multi-agent orchestration. It provides a cohesive framework for weaving agents, tools, and skills into structured workflows. By delegating complex tasks to specialized agents and monitoring execution state through hooks, Weave ensures reliable and efficient project development.
8
+
9
+ ## Table of Contents
10
+
11
+ - [Overview](#overview)
12
+ - [Documentation](#documentation)
13
+ - [Agents](#agents)
14
+ - [Agent Modes](#agent-modes)
15
+ - [Agent Details](#agent-details)
16
+ - [Workflow](#workflow)
17
+ - [When the Full Workflow Is Used](#when-the-full-workflow-is-used)
18
+ - [1. Plan](#1-plan)
19
+ - [2. Review (Optional)](#2-review-optional)
20
+ - [3. Execute](#3-execute)
21
+ - [Resuming Interrupted Work](#resuming-interrupted-work)
22
+ - [Quick Tasks (No Plan Needed)](#quick-tasks-no-plan-needed)
23
+ - [Installation](#installation)
24
+ - [Prerequisites](#prerequisites)
25
+ - [Step 1: Add to fabric.json](#step-1-add-to-fabricjson)
26
+ - [Step 2: Restart Fabric](#step-2-restart-fabric)
27
+ - [Troubleshooting](#troubleshooting)
28
+ - [Uninstalling](#uninstalling)
29
+ - [Configuration](#configuration)
30
+ - [Example Configuration](#example-configuration)
31
+ - [Configuration Fields](#configuration-fields)
32
+ - [Features](#features)
33
+ - [Hooks](#hooks)
34
+ - [Skills](#skills)
35
+ - [Background Agents](#background-agents)
36
+ - [Tool Permissions](#tool-permissions)
37
+ - [Development](#development)
38
+ - [Acknowledgments](#acknowledgments)
39
+ - [License](#license)
40
+
41
+ ## Overview
42
+
43
+ - **8 specialized agents** with weaving-themed names designed for specific roles in the development lifecycle.
44
+ - **Category-based task dispatch** to route work to domain-optimized models and configurations.
45
+ - **Skill system** for injecting domain-specific expertise that modifies agent behavior via prompt orchestration.
46
+ - **Background agent management** for parallel asynchronous sub-agent execution with concurrency control.
47
+ - **Context window monitoring** to track token usage and suggest recovery strategies when limits are approached.
48
+ - **Tool permissions** enforced per-agent to ensure safety and prevent unauthorized file modifications.
49
+ - **JSONC configuration** supporting comments and trailing commas with hierarchical user and project-level merging.
50
+
51
+ ## Documentation
52
+
53
+ Visit [Fabric Agents](https://agents.fabric.pro) for more information, or head straight to the [documentation](https://fabric.pro/docs/) for detailed guides on setup, configuration, and usage.
54
+
55
+ ## Agents
56
+
57
+ | Agent | Role | Mode | Description |
58
+ | :--- | :--- | :--- | :--- |
59
+ | **Loom** | main orchestrator | primary | The central team lead that plans tasks, coordinates work, and delegates to specialized agents. |
60
+ | **Tapestry** | execution orchestrator | primary | Manages todo-list driven execution of multi-step plans, focusing on sequential implementation without subagent spawning. |
61
+ | **Shuttle** | category worker | all | Domain-specific specialist worker with full tool access, dispatched dynamically via the category system. |
62
+ | **Pattern** | strategic planner | subagent | Analyzes requirements and produces detailed implementation plans with research and dependency mapping. |
63
+ | **Thread** | codebase explorer | subagent | Fast, read-only codebase navigation and analysis using grep, glob, and read tools. |
64
+ | **Spindle** | external researcher | subagent | Performs external documentation lookups and reference searches, providing synthesized answers with source citations. |
65
+ | **Weft** | reviewer/auditor | subagent | Reviews completed work and plans with a critical but fair eye, rejecting only for true blocking issues. |
66
+ | **Warp** | security auditor | subagent | Audits code changes for security vulnerabilities and specification compliance with a skeptical bias. |
67
+
68
+ ### Agent Modes
69
+
70
+ - `primary`: Respects the user-selected model in the Fabric UI.
71
+ - `subagent`: Uses its own model or fallback chain, ignoring UI selection for predictable specialization.
72
+ - `all`: Available in both primary and subagent contexts.
73
+
74
+ ### Agent Details
75
+
76
+ **Loom** is the central orchestrator and the default entry point for every request. It breaks down complex problems into tasks, decides which agents to delegate to, and tracks progress obsessively via todo lists. Loom never implements code directly — it plans and delegates. For quick fixes it acts immediately; for complex work it kicks off the plan → review → execute workflow.
77
+
78
+ **Pattern** is the strategic planner. When a task requires 5+ steps or involves architectural decisions, Loom delegates to Pattern, which researches the codebase (via Thread) and external docs (via Spindle), then produces a structured implementation plan saved to `.weave/plans/{name}.md`. Plans use `- [ ]` checkboxes for every actionable task. Pattern never writes code — only plans.
79
+
80
+ **Weft** is the reviewer and auditor. It validates plans before execution and reviews completed work after implementation. Weft is approval-biased and only rejects for true blocking issues (max 3 per review). It checks that file references are correct, tasks have sufficient context, implementations match requirements, and no stubs or TODOs are left behind. Weft is read-only.
81
+
82
+ **Warp** is the security and specification compliance auditor. It reviews code changes for security vulnerabilities (injection, auth bypass, token handling, crypto weaknesses) and verifies compliance with standards like OAuth2, OIDC, WebAuthn, and JWT. Warp has a skeptical bias — unlike Weft, it rejects by default when security patterns are detected. It self-triages to fast-exit on non-security changes, and can webfetch RFCs for verification. Warp is read-only.
83
+
84
+ **Tapestry** is the execution engine. Activated by the `/start-work` command, it reads a plan from `.weave/plans/` and works through tasks sequentially — writing code, running commands, verifying output, and marking checkboxes as it goes. Tapestry cannot spawn subagents; it focuses on heads-down implementation. If interrupted, it resumes from the first unchecked task.
85
+
86
+ **Thread** is the fast codebase explorer. Loom delegates to Thread whenever it needs to understand code structure, find files, or answer questions about the repository. Thread uses grep, glob, and read tools with zero creativity (temperature 0.0) to return precise, factual answers with file paths and line numbers. Thread is read-only.
87
+
88
+ **Spindle** is the external researcher. When Loom needs documentation for a library, API reference, or any information outside the codebase, Spindle fetches URLs, reads docs, and synthesizes findings with source citations. Spindle is read-only.
89
+
90
+ **Shuttle** is the domain specialist. When work falls into a specific category (e.g., visual engineering, data processing), Loom dispatches Shuttle with full tool access to execute the task. Shuttle's model and configuration can be overridden per-category for domain-optimized performance.
91
+
92
+ ## Workflow
93
+
94
+ Weave uses a structured **Plan → Review → Execute** workflow for complex tasks. Simple requests are handled directly by Loom without the full cycle.
95
+
96
+ ### When the Full Workflow Is Used
97
+
98
+ - Tasks requiring 5+ steps or architectural decisions
99
+ - Multi-file refactors or new feature implementations
100
+ - Work that benefits from a reviewable plan before execution
101
+
102
+ ### 1. Plan
103
+
104
+ Loom delegates to **Pattern**, which researches the codebase and produces a detailed implementation plan:
105
+
106
+ ```
107
+ User Request → Loom (assesses complexity) → Pattern (researches + plans)
108
+
109
+ .weave/plans/{name}.md
110
+ ```
111
+
112
+ The plan includes clear objectives, deliverables, and atomic tasks marked with `- [ ]` checkboxes. Pattern never writes code.
113
+
114
+ ### 2. Review (Optional)
115
+
116
+ For high-stakes or complex plans, Loom delegates to **Weft** to validate the plan before execution:
117
+
118
+ ```
119
+ .weave/plans/{name}.md → Weft (validates) → APPROVE or REJECT
120
+ ```
121
+
122
+ Weft checks that referenced files exist, tasks have sufficient context, and there are no contradictions. If rejected, issues are sent back to Pattern for revision.
123
+
124
+ ### 3. Execute
125
+
126
+ The user runs `/start-work` to begin execution:
127
+
128
+ ```
129
+ /start-work [plan-name] → creates .weave/state.json → switches to Tapestry
130
+ ```
131
+
132
+ **Tapestry** reads the plan and executes tasks sequentially:
133
+
134
+ 1. Find the first unchecked `- [ ]` task
135
+ 2. Implement the task (write code, run commands, create files)
136
+ 3. Verify completion (read files, run tests, check acceptance criteria)
137
+ 4. Mark the checkbox `- [x]`
138
+ 5. Move to the next unchecked task
139
+ 6. When all tasks are complete, report a final summary
140
+
141
+ ### Resuming Interrupted Work
142
+
143
+ If a session is interrupted, running `/start-work` again resumes from the first unchecked task — no re-planning or restarting. The work state is persisted in `.weave/state.json`, so progress is never lost.
144
+
145
+ ### Quick Tasks (No Plan Needed)
146
+
147
+ For simple requests — single-file fixes, quick questions, small edits — Loom handles the work directly or delegates to the appropriate agent without creating a formal plan.
148
+
149
+ ## Installation
150
+
151
+ This package is published on [npm](https://www.npmjs.com/package/@fabriccode/weave).
152
+
153
+ ### Prerequisites
154
+
155
+ - [Fabric](https://fabric.pro)
156
+
157
+ ### Step 1: Add to fabric.json
158
+
159
+ Add the plugin to your `fabric.json` file:
160
+
161
+ ```json
162
+ {
163
+ "plugin": ["@fabriccode/weave"]
164
+ }
165
+ ```
166
+
167
+ ### Step 2: Restart Fabric
168
+
169
+ Fabric automatically installs npm plugins at startup — no manual `bun add` or `npm install` required. The plugin loads automatically upon restart and works with zero configuration out of the box.
170
+
171
+ ### Troubleshooting
172
+
173
+ | Issue | Solution |
174
+ |-------|----------|
175
+ | `404 Not Found` | Ensure the package name is correct: `@fabriccode/weave`. |
176
+ | Package not found after publish | npm can take a few minutes to propagate. Wait and retry. |
177
+
178
+ ## Uninstalling
179
+
180
+ To fully remove the Weave plugin from your project:
181
+
182
+ ### Step 1: Remove from fabric.json
183
+
184
+ Delete the `@fabriccode/weave` entry from the `plugin` array in your `fabric.json`:
185
+
186
+ ```json
187
+ {
188
+ "plugin": []
189
+ }
190
+ ```
191
+
192
+ ### Step 2: Clean up project artifacts (optional)
193
+
194
+ Weave may have created plan and state files during usage. Remove them if no longer needed:
195
+
196
+ ```bash
197
+ rm -rf .weave/
198
+ ```
199
+
200
+ You can also remove any project-level configuration if present:
201
+
202
+ ```bash
203
+ rm -f .fabric/weave-fabric.jsonc .fabric/weave-fabric.json
204
+ ```
205
+
206
+ ### Step 3: Clean up user-level configuration (optional)
207
+
208
+ If you no longer use Weave in any project, remove the global configuration:
209
+
210
+ ```bash
211
+ rm -f ~/.config/fabric/weave-fabric.jsonc ~/.config/fabric/weave-fabric.json
212
+ ```
213
+
214
+ ## Configuration
215
+
216
+ Weave searches for configuration files in the following locations, merging them in order (user config → project config → defaults):
217
+
218
+ - **Project**: `.fabric/weave-fabric.jsonc` or `.fabric/weave-fabric.json`
219
+ - **User**: `~/.config/fabric/weave-fabric.jsonc` or `~/.config/fabric/weave-fabric.json`
220
+
221
+ The configuration uses JSONC format, allowing for comments and trailing commas.
222
+
223
+ ### Example Configuration
224
+
225
+ ```jsonc
226
+ {
227
+ // Override agent models and parameters
228
+ "agents": {
229
+ "loom": {
230
+ "model": "anthropic/claude-3-5-sonnet",
231
+ "temperature": 0.1
232
+ },
233
+ "thread": {
234
+ "model": "openai/gpt-4o-mini"
235
+ }
236
+ },
237
+ // Category-based dispatch overrides
238
+ "categories": {
239
+ "visual-engineering": {
240
+ "model": "google/gemini-2-pro"
241
+ }
242
+ },
243
+ // Selective feature toggling
244
+ "disabled_hooks": [],
245
+ "disabled_agents": [],
246
+ "disabled_tools": [],
247
+ "disabled_skills": [],
248
+ // Background agent concurrency limits
249
+ "background": {
250
+ "defaultConcurrency": 5
251
+ }
252
+ }
253
+ ```
254
+
255
+ ### Configuration Fields
256
+
257
+ - `agents` — Override model, temperature, prompt_append, tools, and skills per agent.
258
+ - `categories` — Custom model and tool configurations for category-based dispatch.
259
+ - `disabled_hooks` / `disabled_agents` / `disabled_tools` / `disabled_skills` — Selective feature disabling.
260
+ - `background` — Concurrency limits and timeouts for parallel background agents.
261
+ - `tmux` — Terminal multiplexer layout settings for TUI integration.
262
+ - `skills` — Custom skill discovery paths and recursion settings.
263
+ - `experimental` — Plugin load timeouts and context window threshold adjustments.
264
+
265
+ ## Features
266
+
267
+ ### Hooks
268
+
269
+ Weave includes 5 built-in hooks that monitor and modify agent behavior:
270
+
271
+ - `context-window-monitor` — Warns when token usage approaches limits and suggests recovery strategies.
272
+ - `write-existing-file-guard` — Tracks file reads to prevent agents from overwriting files they haven't examined.
273
+ - `rules-injector` — Automatically injects contextual rules when agents enter directories containing AGENTS.md.
274
+ - `first-message-variant` — Applies specific prompt variants on session start for consistent behavior.
275
+ - `keyword-detector` — Detects keywords in messages to trigger behavioral changes or agent switches.
276
+
277
+ All hooks are enabled by default and can be disabled via the `disabled_hooks` configuration.
278
+
279
+ ### Skills
280
+
281
+ Skills are injectable prompt expertise loaded from markdown files (SKILL.md). They modify agent behavior by prepending domain-specific instructions to the agent's system prompt.
282
+
283
+ Skills are discovered across three scopes:
284
+ - `builtin` — Provided by the Weave plugin.
285
+ - `user` — Located in the user's global configuration directory.
286
+ - `project` — Located in the current project's `.fabric/skills/` directory.
287
+
288
+ ### Background Agents
289
+
290
+ Weave supports parallel asynchronous sub-agent management via the BackgroundManager. This allows Loom to spawn multiple agents simultaneously to handle independent tasks, with configurable concurrency limits to manage API rate limits.
291
+
292
+ ### Tool Permissions
293
+
294
+ Tool access is controlled per-agent to ensure safety and specialized focus. For example, **Thread** and **Spindle** are strictly read-only; they are denied access to write, edit, and task management tools. These permissions can be customized globally or per-agent in the configuration.
295
+
296
+ ## Development
297
+
298
+ - **Build**: `bun run build`
299
+ - **Test**: `bun test`
300
+ - **Typecheck**: `bun run typecheck`
301
+ - **Clean**: `bun run clean`
302
+
303
+ ## Acknowledgments
304
+
305
+ Weave was inspired by [Oh My Fabric](https://github.com/code-yeongyu/oh-my-fabric) by [@code-yeongyu](https://github.com/code-yeongyu) — a pioneering Fabric plugin that proved multi-agent orchestration, discipline agents, and structured plan-execute workflows could radically improve the developer experience. Many of Weave's core ideas — from category-based task dispatch to background agent parallelism — trace their roots to patterns Oh My Fabric established. We're grateful for the trailblazing work and the vibrant community around it.
306
+
307
+ ## License
308
+
309
+ MIT
@@ -0,0 +1,24 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ import type { AgentSource } from "./types";
3
+ import type { CategoriesConfig } from "../config/schema";
4
+ export type ResolveSkillsFn = (skillNames: string[], disabledSkills?: Set<string>) => string;
5
+ export type BuildAgentOptions = {
6
+ categories?: CategoriesConfig;
7
+ disabledSkills?: Set<string>;
8
+ resolveSkills?: ResolveSkillsFn;
9
+ disabledAgents?: Set<string>;
10
+ };
11
+ /**
12
+ * Register name variants for a custom agent so that
13
+ * `stripDisabledAgentReferences` can strip its references from prompts.
14
+ * Does not override existing (builtin) entries.
15
+ */
16
+ export declare function registerAgentNameVariants(name: string, variants?: string[]): void;
17
+ /**
18
+ * Remove lines from a prompt that reference disabled agents.
19
+ * Only strips lines where an agent name appears as a standalone concept
20
+ * (e.g. "Use thread (codebase explorer)"), not incidental word matches.
21
+ * Uses word-boundary matching to avoid false positives.
22
+ */
23
+ export declare function stripDisabledAgentReferences(prompt: string, disabled: Set<string>): string;
24
+ export declare function buildAgent(source: AgentSource, model: string, options?: BuildAgentOptions): AgentConfig;
@@ -0,0 +1,32 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ import type { AgentPromptMetadata, WeaveAgentName } from "./types";
3
+ import type { CategoriesConfig, AgentOverrideConfig } from "../config/schema";
4
+ import type { ResolveSkillsFn } from "./agent-builder";
5
+ import type { ProjectFingerprint } from "../features/analytics/types";
6
+ import type { AvailableAgent } from "./dynamic-prompt-builder";
7
+ export interface CreateBuiltinAgentsOptions {
8
+ disabledAgents?: string[];
9
+ agentOverrides?: Record<string, AgentOverrideConfig>;
10
+ categories?: CategoriesConfig;
11
+ uiSelectedModel?: string;
12
+ systemDefaultModel?: string;
13
+ availableModels?: Set<string>;
14
+ disabledSkills?: Set<string>;
15
+ resolveSkills?: ResolveSkillsFn;
16
+ /** Project fingerprint for injecting project context into agent prompts */
17
+ fingerprint?: ProjectFingerprint | null;
18
+ /** Custom agent metadata for Loom's dynamic delegation prompt */
19
+ customAgentMetadata?: AvailableAgent[];
20
+ }
21
+ export declare const AGENT_METADATA: Record<WeaveAgentName, AgentPromptMetadata>;
22
+ /**
23
+ * Register metadata for a custom agent. Used by create-managers.ts
24
+ * to integrate custom agents into Loom's dynamic prompt builder.
25
+ */
26
+ export declare function registerCustomAgentMetadata(name: string, metadata: AgentPromptMetadata): void;
27
+ /**
28
+ * Get all agent metadata — builtins + registered custom agents.
29
+ * Returns a new merged record on each call.
30
+ */
31
+ export declare function getAllAgentMetadata(): Record<string, AgentPromptMetadata>;
32
+ export declare function createBuiltinAgents(options?: CreateBuiltinAgentsOptions): Record<string, AgentConfig>;
@@ -0,0 +1,24 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ import type { CustomAgentConfig } from "../config/schema";
3
+ import type { AgentPromptMetadata } from "./types";
4
+ import type { ResolveSkillsFn } from "./agent-builder";
5
+ export interface BuildCustomAgentOptions {
6
+ resolveSkills?: ResolveSkillsFn;
7
+ disabledSkills?: Set<string>;
8
+ availableModels?: Set<string>;
9
+ systemDefaultModel?: string;
10
+ uiSelectedModel?: string;
11
+ /** Base directory for resolving relative prompt_file paths */
12
+ configDir?: string;
13
+ }
14
+ /**
15
+ * Build an AgentConfig from a custom agent definition.
16
+ * Handles prompt resolution (inline, file, or skills), model resolution,
17
+ * and display name registration.
18
+ */
19
+ export declare function buildCustomAgent(name: string, config: CustomAgentConfig, options?: BuildCustomAgentOptions): AgentConfig;
20
+ /**
21
+ * Build AgentPromptMetadata for a custom agent from its config.
22
+ * Used to integrate custom agents into Loom's delegation table.
23
+ */
24
+ export declare function buildCustomAgentMetadata(name: string, config: CustomAgentConfig): AgentPromptMetadata;
@@ -0,0 +1,35 @@
1
+ import type { AgentPromptMetadata } from "./types";
2
+ import type { ProjectFingerprint } from "../features/analytics/types";
3
+ export interface AvailableAgent {
4
+ name: string;
5
+ description: string;
6
+ metadata: AgentPromptMetadata;
7
+ }
8
+ export interface AvailableTool {
9
+ name: string;
10
+ category: "lsp" | "ast" | "search" | "session" | "command" | "other";
11
+ }
12
+ export interface AvailableSkill {
13
+ name: string;
14
+ description: string;
15
+ location: "user" | "project" | "builtin";
16
+ }
17
+ export interface AvailableCategory {
18
+ name: string;
19
+ description: string;
20
+ model?: string;
21
+ }
22
+ export declare function categorizeTools(toolNames: string[]): AvailableTool[];
23
+ export declare function buildKeyTriggersSection(agents: AvailableAgent[], _skills?: AvailableSkill[]): string;
24
+ export declare function buildToolSelectionTable(agents: AvailableAgent[], tools?: AvailableTool[], _skills?: AvailableSkill[]): string;
25
+ export declare function buildThreadSection(agents: AvailableAgent[]): string;
26
+ export declare function buildSpindleSection(agents: AvailableAgent[]): string;
27
+ export declare function buildWeftSection(agents: AvailableAgent[]): string;
28
+ export declare function buildWarpSection(agents: AvailableAgent[]): string;
29
+ export declare function buildDelegationTable(agents: AvailableAgent[]): string;
30
+ export declare function buildCategorySkillsDelegationGuide(categories: AvailableCategory[], skills: AvailableSkill[]): string;
31
+ /**
32
+ * Build a project context section from a codebase fingerprint.
33
+ * Returns an empty string if no fingerprint is available.
34
+ */
35
+ export declare function buildProjectContextSection(fingerprint: ProjectFingerprint | null | undefined): string;
@@ -0,0 +1,12 @@
1
+ export { createBuiltinAgents, AGENT_METADATA, registerCustomAgentMetadata, getAllAgentMetadata } from "./builtin-agents";
2
+ export type { CreateBuiltinAgentsOptions } from "./builtin-agents";
3
+ export { buildAgent, stripDisabledAgentReferences } from "./agent-builder";
4
+ export type { BuildAgentOptions, ResolveSkillsFn } from "./agent-builder";
5
+ export { resolveAgentModel, AGENT_MODEL_REQUIREMENTS } from "./model-resolution";
6
+ export type { FallbackEntry, AgentModelRequirement, ResolveAgentModelOptions } from "./model-resolution";
7
+ export { buildCustomAgent, buildCustomAgentMetadata } from "./custom-agent-factory";
8
+ export type { BuildCustomAgentOptions } from "./custom-agent-factory";
9
+ export { loadPromptFile } from "./prompt-loader";
10
+ export * from "./dynamic-prompt-builder";
11
+ export type { AgentMode, AgentFactory, AgentSource, AgentCategory, AgentCost, DelegationTrigger, AgentPromptMetadata, WeaveAgentName, } from "./types";
12
+ export { isFactory, isGptModel } from "./types";
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ export declare const LOOM_DEFAULTS: AgentConfig;
@@ -0,0 +1,11 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ import type { AgentFactory } from "../types";
3
+ import type { AvailableAgent } from "../dynamic-prompt-builder";
4
+ import type { ProjectFingerprint } from "../../features/analytics/types";
5
+ export { composeLoomPrompt } from "./prompt-composer";
6
+ export type { LoomPromptOptions } from "./prompt-composer";
7
+ /**
8
+ * Create a Loom agent config with optional disabled agents, fingerprint, and custom agents for prompt composition.
9
+ */
10
+ export declare function createLoomAgentWithOptions(model: string, disabledAgents?: Set<string>, fingerprint?: ProjectFingerprint | null, customAgents?: AvailableAgent[]): AgentConfig;
11
+ export declare const createLoomAgent: AgentFactory;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Loom prompt composer — assembles the Loom system prompt from sections,
3
+ * conditionally including/excluding content based on enabled agents.
4
+ *
5
+ * Default behavior (no disabled agents) produces identical output to the
6
+ * hardcoded LOOM_DEFAULTS.prompt string.
7
+ */
8
+ import type { ProjectFingerprint } from "../../features/analytics/types";
9
+ import type { AvailableAgent } from "../dynamic-prompt-builder";
10
+ export interface LoomPromptOptions {
11
+ /** Set of disabled agent names (lowercase config keys) */
12
+ disabledAgents?: Set<string>;
13
+ /** Project fingerprint for injecting project context into the prompt */
14
+ fingerprint?: ProjectFingerprint | null;
15
+ /** Custom agent metadata for dynamic delegation sections */
16
+ customAgents?: AvailableAgent[];
17
+ }
18
+ export declare function buildRoleSection(): string;
19
+ export declare function buildDisciplineSection(): string;
20
+ export declare function buildSidebarTodosSection(): string;
21
+ export declare function buildDelegationSection(disabled: Set<string>): string;
22
+ export declare function buildDelegationNarrationSection(disabled?: Set<string>): string;
23
+ export declare function buildPlanWorkflowSection(disabled: Set<string>): string;
24
+ export declare function buildReviewWorkflowSection(disabled: Set<string>): string;
25
+ export declare function buildStyleSection(): string;
26
+ /**
27
+ * Build a delegation section for custom agents.
28
+ * Returns empty string if no enabled custom agents exist.
29
+ */
30
+ export declare function buildCustomAgentDelegationSection(customAgents: AvailableAgent[], disabled: Set<string>): string;
31
+ /**
32
+ * Compose the full Loom system prompt from sections.
33
+ * When no agents are disabled, produces identical output to LOOM_DEFAULTS.prompt.
34
+ */
35
+ export declare function composeLoomPrompt(options?: LoomPromptOptions): string;
@@ -0,0 +1,27 @@
1
+ import type { AgentMode, WeaveAgentName } from "./types";
2
+ export type FallbackEntry = {
3
+ providers: string[];
4
+ model: string;
5
+ variant?: string;
6
+ };
7
+ export type AgentModelRequirement = {
8
+ fallbackChain: FallbackEntry[];
9
+ };
10
+ export declare const AGENT_MODEL_REQUIREMENTS: Record<WeaveAgentName, AgentModelRequirement>;
11
+ export type ResolveAgentModelOptions = {
12
+ availableModels: Set<string>;
13
+ agentMode: AgentMode;
14
+ uiSelectedModel?: string;
15
+ categoryModel?: string;
16
+ overrideModel?: string;
17
+ systemDefaultModel?: string;
18
+ /** Custom fallback chain for agents not in AGENT_MODEL_REQUIREMENTS */
19
+ customFallbackChain?: FallbackEntry[];
20
+ };
21
+ /**
22
+ * Resolve the model for an agent. Accepts any string agent name.
23
+ * Built-in agents use AGENT_MODEL_REQUIREMENTS for fallback chains.
24
+ * Custom agents use the customFallbackChain option, or fall through
25
+ * to system default / hardcoded fallback.
26
+ */
27
+ export declare function resolveAgentModel(agentName: string, options: ResolveAgentModelOptions): string;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ export declare const PATTERN_DEFAULTS: AgentConfig;
@@ -0,0 +1,2 @@
1
+ import type { AgentFactory } from "../types";
2
+ export declare const createPatternAgent: AgentFactory;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Load a prompt from a file path. Supports .md and .txt files.
3
+ * Paths are sandboxed to basePath (or cwd) — traversal outside is rejected.
4
+ *
5
+ * @param promptFilePath - Path to the prompt file (relative to basePath; absolute paths are rejected)
6
+ * @param basePath - Base directory for resolving relative paths (defaults to cwd)
7
+ * @returns The file contents as a string, or null if the file doesn't exist or path escapes the sandbox
8
+ */
9
+ export declare function loadPromptFile(promptFilePath: string, basePath?: string): string | null;
@@ -0,0 +1,2 @@
1
+ /** Check whether an agent is enabled (not in the disabled set). */
2
+ export declare function isAgentEnabled(name: string, disabled: Set<string>): boolean;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ export declare const SHUTTLE_DEFAULTS: AgentConfig;
@@ -0,0 +1,2 @@
1
+ import type { AgentFactory } from "../types";
2
+ export declare const createShuttleAgent: AgentFactory;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ export declare const SPINDLE_DEFAULTS: AgentConfig;
@@ -0,0 +1,2 @@
1
+ import type { AgentFactory } from "../types";
2
+ export declare const createSpindleAgent: AgentFactory;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ export declare const TAPESTRY_DEFAULTS: AgentConfig;
@@ -0,0 +1,9 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ import type { AgentFactory } from "../types";
3
+ export { composeTapestryPrompt } from "./prompt-composer";
4
+ export type { TapestryPromptOptions } from "./prompt-composer";
5
+ /**
6
+ * Create a Tapestry agent config with optional disabled agents for prompt composition.
7
+ */
8
+ export declare function createTapestryAgentWithOptions(model: string, disabledAgents?: Set<string>): AgentConfig;
9
+ export declare const createTapestryAgent: AgentFactory;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Tapestry prompt composer — assembles the Tapestry system prompt from sections,
3
+ * conditionally including/excluding content based on enabled agents.
4
+ *
5
+ * Default behavior (no disabled agents) produces identical output to the
6
+ * hardcoded TAPESTRY_DEFAULTS.prompt string.
7
+ */
8
+ export interface TapestryPromptOptions {
9
+ /** Set of disabled agent names (lowercase config keys) */
10
+ disabledAgents?: Set<string>;
11
+ }
12
+ export declare function buildTapestryRoleSection(): string;
13
+ export declare function buildTapestryDisciplineSection(): string;
14
+ export declare function buildTapestrySidebarTodosSection(): string;
15
+ export declare function buildTapestryPlanExecutionSection(disabled?: Set<string>): string;
16
+ export declare function buildTapestryVerificationSection(): string;
17
+ export declare function buildTapestryPostExecutionReviewSection(disabled: Set<string>): string;
18
+ export declare function buildTapestryExecutionSection(): string;
19
+ export declare function buildTapestryStyleSection(): string;
20
+ /**
21
+ * Compose the full Tapestry system prompt from sections.
22
+ * When no agents are disabled, produces identical output to TAPESTRY_DEFAULTS.prompt.
23
+ */
24
+ export declare function composeTapestryPrompt(options?: TapestryPromptOptions): string;
@@ -0,0 +1,2 @@
1
+ import type { AgentConfig } from "@fabriccode/sdk";
2
+ export declare const THREAD_DEFAULTS: AgentConfig;
@@ -0,0 +1,2 @@
1
+ import type { AgentFactory } from "../types";
2
+ export declare const createThreadAgent: AgentFactory;