Skip to content

Commit 988d455

Browse files
nhortonclaude
andcommitted
docs: Add experts system specification and initial standard expert
Add specification for the experts system - auto-improving collections of domain knowledge that get exposed as Claude agents. - Add doc/experts_requirements.md with full specification: - Directory structure (.deepwork/experts/[name]/) - File formats (expert.yml, topics/*.md, learnings/*.md) - CLI commands (deepwork topics, deepwork learnings) - Sync behavior (generates agents in .claude/agents/) - Add initial "experts" standard expert in src/deepwork/standard/experts/: - Meta-expert for the experts system itself - Topics on design patterns and discovery descriptions - Update doc/architecture.md: - Add src/deepwork/standard/ directory to structure diagram - Add "Experts (Planned)" section Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8ad17fe commit 988d455

6 files changed

Lines changed: 535 additions & 1 deletion

File tree

doc/architecture.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ deepwork/ # DeepWork tool repository
6363
│ │ │ └── skill-job-step.md.jinja
6464
│ │ ├── gemini/
6565
│ │ └── copilot/
66-
│ ├── standard_jobs/ # Built-in job definitions
66+
│ ├── standard_jobs/ # Built-in job definitions (legacy location)
6767
│ │ ├── deepwork_jobs/
6868
│ │ │ ├── job.yml
6969
│ │ │ ├── steps/
@@ -77,6 +77,13 @@ deepwork/ # DeepWork tool repository
7777
│ │ ├── global_hooks.yml
7878
│ │ ├── user_prompt_submit.sh
7979
│ │ └── capture_prompt_work_tree.sh
80+
│ ├── standard/ # Standard assets (new consolidated location)
81+
│ │ └── experts/ # Built-in expert definitions
82+
│ │ └── experts/ # Meta-expert for the experts system itself
83+
│ │ ├── expert.yml
84+
│ │ ├── topics/
85+
│ │ └── learnings/
86+
│ │ └── .gitkeep
8087
│ ├── schemas/ # Definition schemas
8188
│ │ ├── job_schema.py
8289
│ │ ├── doc_spec_schema.py # Doc spec schema definition
@@ -1335,6 +1342,22 @@ Claude: Created rule "API documentation update" in .deepwork/rules/api-documenta
13351342

13361343
---
13371344

1345+
## Experts (Planned)
1346+
1347+
Experts are auto-improving collections of domain knowledge. They provide a structured mechanism for accumulating expertise and exposing it through Claude agents.
1348+
1349+
**Status**: Specification complete, implementation pending.
1350+
1351+
See `doc/experts_requirements.md` for the full specification.
1352+
1353+
**Key Concepts**:
1354+
- Experts live in `.deepwork/experts/[name]/` with `expert.yml`, `topics/`, and `learnings/`
1355+
- Standard experts ship from `src/deepwork/standard/experts/` and are installed during `deepwork install`
1356+
- `deepwork sync` will generate Claude agents in `.claude/agents/` with `dwe_` prefix
1357+
- CLI commands: `deepwork topics --expert "name"` and `deepwork learnings --expert "name"`
1358+
1359+
---
1360+
13381361
## Technical Decisions
13391362

13401363
### Language: Python 3.11+

doc/experts_requirements.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# Experts System
2+
3+
> **Status**: Specification complete, implementation pending. This document describes planned functionality.
4+
5+
Experts are auto-improving collections of domain knowledge. They provide a structured mechanism for accumulating expertise and exposing it throughout the system.
6+
7+
## Overview
8+
9+
Each expert represents deep knowledge in a specific domain (e.g., "Ruby on Rails ActiveJob", "Social Marketing"). Experts consist of:
10+
- **Core expertise**: The foundational knowledge about the domain
11+
- **Topics**: Detailed documentation on specific subjects within the domain
12+
- **Learnings**: Hard-fought insights from real experiences
13+
14+
## Directory Structure
15+
16+
Experts live in `.deepwork/experts/[expert-folder-name]/`:
17+
18+
```
19+
.deepwork/experts/
20+
└── rails_activejob/
21+
├── expert.yml # Core expert definition
22+
├── topics/ # Detailed topic documentation
23+
│ └── retry_handling.md
24+
└── learnings/ # Experience-based insights
25+
└── job_errors_not_going_to_sentry.md
26+
```
27+
28+
### Naming Convention
29+
30+
The **expert name** is derived from the folder name:
31+
- Spaces and underscores become dashes
32+
- Example: folder `rails_activejob` → expert name `rails-activejob`
33+
- This name is used in CLI commands: `deepwork topics --expert "rails-activejob"`
34+
35+
## File Formats
36+
37+
### expert.yml
38+
39+
```yaml
40+
discovery_description: |
41+
Short description used by other parts of the system to decide
42+
whether to invoke this expert. Keep it concise and specific.
43+
44+
full_expertise: |
45+
Unlimited text (but generally ~5 pages max) containing the
46+
complete current knowledge of this domain. This is the core
47+
expertise that gets included in the generated agent.
48+
```
49+
50+
**Note**: The expert name is not a field in this file—it's derived from the folder name.
51+
52+
### topics/*.md
53+
54+
Topics are frontmatter Markdown files covering specific subjects within the domain.
55+
56+
```markdown
57+
---
58+
name: Retry Handling
59+
keywords:
60+
- retry
61+
- exponential backoff
62+
- dead letter queue
63+
last_updated: 2025-01-15
64+
---
65+
66+
Detailed documentation about retry handling in ActiveJob...
67+
```
68+
69+
| Field | Description |
70+
|-------|-------------|
71+
| `name` | Human-readable name (e.g., "Retry Handling") |
72+
| `keywords` | Topic-specific keywords only—avoid broad terms like "Rails" |
73+
| `last_updated` | Date stamp (manually maintained) |
74+
75+
Filenames are purely organizational and don't affect functionality.
76+
77+
### learnings/*.md
78+
79+
Learnings document complex experiences and hard-fought insights—like mini retrospectives.
80+
81+
```markdown
82+
---
83+
name: Job errors not going to Sentry
84+
last_updated: 2025-01-20
85+
summarized_result: |
86+
Sentry changed their standard gem for hooking into jobs.
87+
SolidQueue still worked but ActiveJobKubernetes did not.
88+
---
89+
90+
## Context
91+
We noticed errors from background jobs weren't appearing in Sentry...
92+
93+
## Investigation
94+
After debugging, we discovered that Sentry's latest gem update...
95+
96+
## Resolution
97+
Updated the initialization to explicitly configure the hook...
98+
```
99+
100+
| Field | Description |
101+
|-------|-------------|
102+
| `name` | Human-readable title of the learning |
103+
| `last_updated` | Date stamp (manually maintained) |
104+
| `summarized_result` | Brief summary of the key finding |
105+
106+
## CLI Commands
107+
108+
### List Topics
109+
110+
```bash
111+
deepwork topics --expert "rails-activejob"
112+
```
113+
114+
Returns a Markdown list of topics:
115+
- Name and relative file path as a Markdown link
116+
- Followed by keywords
117+
- Sorted by most-recently-updated
118+
119+
### List Learnings
120+
121+
```bash
122+
deepwork learnings --expert "rails-activejob"
123+
```
124+
125+
Returns a Markdown list of learnings:
126+
- Name and relative file path as a Markdown link
127+
- Followed by the summarized result
128+
- Sorted by most-recently-updated
129+
130+
## Sync Behavior
131+
132+
`deepwork sync` generates Claude agents from experts (in addition to syncing jobs).
133+
134+
### Generated Agent Location
135+
136+
Agents are created in `.claude/agents/` with:
137+
- **Filename**: `dwe_[expert-name].md` (e.g., `dwe_rails-activejob.md`)
138+
- **name field**: `[expert-name]-expert` (e.g., `rails-activejob-expert`)
139+
- **description**: The `discovery_description` from expert.yml
140+
141+
### Agent Body Content
142+
143+
The agent body combines:
144+
1. The `full_expertise` text
145+
2. A topics list using Claude's dynamic command embedding:
146+
```
147+
$(deepwork topics --expert "rails-activejob")
148+
```
149+
3. A learnings list using the same mechanism:
150+
```
151+
$(deepwork learnings --expert "rails-activejob")
152+
```
153+
154+
This ensures the agent always has access to the latest topics and learnings at runtime.
155+
156+
## Standard Experts
157+
158+
Standard experts ship with DeepWork and are located at `src/deepwork/standard/experts/`.
159+
160+
When `deepwork install` runs, these are copied into `.deepwork/experts/` in the target project.
161+
162+
## Future Considerations
163+
164+
- Experts and jobs are currently independent systems
165+
- Future versions may enable experts to reference each other and collaborate with jobs

0 commit comments

Comments
 (0)