@itz4blitz/agentful 0.1.11 → 0.2.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.
- package/.claude/agents/architect.md +30 -527
- package/.claude/agents/orchestrator.md +104 -622
- package/.claude/agents/product-analyzer.md +4 -4
- package/.claude/commands/agentful-agents.md +668 -0
- package/.claude/commands/agentful-analyze.md +564 -0
- package/.claude/commands/agentful-product.md +59 -674
- package/.claude/commands/agentful-skills.md +635 -0
- package/.claude/commands/agentful-start.md +4 -4
- package/.claude/commands/agentful-status.md +2 -2
- package/.claude/commands/agentful.md +222 -13
- package/.claude/settings.json +25 -1
- package/.claude/skills/conversation/SKILL.md +292 -15
- package/README.md +24 -7
- package/bin/cli.js +5 -5
- package/bin/hooks/README.md +120 -0
- package/bin/hooks/analyze-trigger.sh +57 -0
- package/bin/hooks/health-check.sh +36 -0
- package/package.json +10 -5
- package/template/CLAUDE.md +72 -192
- package/version.json +1 -1
|
@@ -1,11 +1,220 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agentful
|
|
3
|
-
description:
|
|
3
|
+
description: Natural language interface for agentful human-in-the-loop development. Processes user intent and routes to appropriate handlers.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# agentful
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Natural language interface for human-in-the-loop product development with Claude Code.
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
When this command is invoked:
|
|
13
|
+
|
|
14
|
+
1. **Check if user provided input**: If arguments are provided, this is a natural language request
|
|
15
|
+
2. **If NO input**: Show the Quick Reference section below
|
|
16
|
+
3. **If input provided**: Use the Task tool to delegate to the conversation skill
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# User runs: /agentful build authentication
|
|
20
|
+
# You should execute:
|
|
21
|
+
Task("conversation", "User said: 'build authentication'. Process this using the conversation skill workflow.")
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The conversation skill will:
|
|
25
|
+
- Load conversation state and history
|
|
26
|
+
- Classify intent and extract entities
|
|
27
|
+
- Detect ambiguity and ask clarifying questions if needed
|
|
28
|
+
- Route to appropriate handler (orchestrator, status, validate, etc.)
|
|
29
|
+
- Update conversation state and history
|
|
30
|
+
|
|
31
|
+
## Command Behavior
|
|
32
|
+
|
|
33
|
+
### Without Arguments
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
/agentful
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Shows quick reference and available commands.
|
|
40
|
+
|
|
41
|
+
### With Natural Language Input
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
/agentful <your request>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Examples:**
|
|
48
|
+
- `/agentful build the authentication system`
|
|
49
|
+
- `/agentful fix the memory leak in checkout`
|
|
50
|
+
- `/agentful what's the status?`
|
|
51
|
+
- `/agentful validate the tests`
|
|
52
|
+
|
|
53
|
+
This invokes the **conversation skill** which:
|
|
54
|
+
1. Classifies your intent
|
|
55
|
+
2. Resolves references (pronouns like "it", "that")
|
|
56
|
+
3. Detects ambiguity and asks clarifying questions
|
|
57
|
+
4. Routes to appropriate handler (orchestrator, status, validate, etc.)
|
|
58
|
+
|
|
59
|
+
### Processing Flow
|
|
60
|
+
|
|
61
|
+
When user provides natural language input:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
// 1. Load conversation state and history
|
|
65
|
+
const state = load_conversation_state('.agentful/conversation-state.json');
|
|
66
|
+
const history = read_conversation_history('.agentful/conversation-history.json');
|
|
67
|
+
const productSpec = load_product_spec('.claude/product/');
|
|
68
|
+
|
|
69
|
+
// 2. Check for context loss (>24h gaps)
|
|
70
|
+
const contextRecovery = detect_context_loss(history.messages, state);
|
|
71
|
+
if (contextRecovery.is_stale) {
|
|
72
|
+
return {
|
|
73
|
+
message: contextRecovery.message,
|
|
74
|
+
confirmation: contextRecovery.suggested_confirmation
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 3. Detect mind changes ("actually", "wait", "never mind")
|
|
79
|
+
const mindChange = detect_mind_change(userMessage, state);
|
|
80
|
+
if (mindChange.detected && mindChange.reset_context) {
|
|
81
|
+
reset_conversation_context(state);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 4. Resolve references ("it", "that", "this" → actual feature names)
|
|
85
|
+
const resolved = resolve_references(userMessage, history.messages, state);
|
|
86
|
+
|
|
87
|
+
// 5. Classify intent
|
|
88
|
+
const intent = classify_intent(resolved.resolved, history.messages, productSpec);
|
|
89
|
+
// Possible intents: feature_request, bug_report, question, status_update,
|
|
90
|
+
// clarification, approval, rejection, pause, continue
|
|
91
|
+
|
|
92
|
+
// 6. Extract entities (features, domains, subtasks)
|
|
93
|
+
const entities = extract_feature_mention(resolved.resolved, productSpec);
|
|
94
|
+
|
|
95
|
+
// 7. Detect ambiguity
|
|
96
|
+
const ambiguity = detect_ambiguity(resolved.resolved);
|
|
97
|
+
if (ambiguity.is_ambiguous && ambiguity.confidence > 0.6) {
|
|
98
|
+
const clarification = suggest_clarification(resolved.resolved, productSpec);
|
|
99
|
+
return {
|
|
100
|
+
message: clarification.primary_question,
|
|
101
|
+
suggestions: clarification.suggested_responses
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 8. Route to appropriate handler
|
|
106
|
+
const routing = route_to_handler(intent, entities);
|
|
107
|
+
switch (routing.handler) {
|
|
108
|
+
case 'orchestrator':
|
|
109
|
+
Task('orchestrator', routing.context);
|
|
110
|
+
break;
|
|
111
|
+
case 'status':
|
|
112
|
+
Task('product-tracking', 'show_status');
|
|
113
|
+
break;
|
|
114
|
+
case 'validate':
|
|
115
|
+
Task('validation', 'run_quality_gates');
|
|
116
|
+
break;
|
|
117
|
+
case 'decide':
|
|
118
|
+
Task('decision-handler', 'list_pending_decisions');
|
|
119
|
+
break;
|
|
120
|
+
case 'product':
|
|
121
|
+
Task('product-planning', routing.context);
|
|
122
|
+
break;
|
|
123
|
+
default:
|
|
124
|
+
// Handle inline with conversation skill
|
|
125
|
+
return generate_response(intent, entities, state);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 9. Add to conversation history
|
|
129
|
+
add_message_to_history({
|
|
130
|
+
role: 'user',
|
|
131
|
+
content: userMessage,
|
|
132
|
+
intent: intent.intent,
|
|
133
|
+
entities: entities,
|
|
134
|
+
references_resolved: resolved.references
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// 10. Update conversation state
|
|
138
|
+
update_conversation_state(state, routing.result);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Intent to Handler Mapping
|
|
142
|
+
|
|
143
|
+
| Intent | Handler | Notes |
|
|
144
|
+
|--------|---------|-------|
|
|
145
|
+
| `feature_request` | orchestrator | Delegates to FEATURE_DEVELOPMENT workflow |
|
|
146
|
+
| `bug_report` | orchestrator | Delegates to BUGFIX workflow |
|
|
147
|
+
| `status_update` | product-tracking | Shows completion percentage and current work |
|
|
148
|
+
| `validation` | validation skill | Runs quality gates |
|
|
149
|
+
| `decision` | decision handler | Lists/resolves pending decisions |
|
|
150
|
+
| `question` | inline | Answers using conversation history |
|
|
151
|
+
| `clarification` | inline | Provides more detail on previous response |
|
|
152
|
+
| `approval` | orchestrator | Continues current work |
|
|
153
|
+
| `rejection` | orchestrator | Stops current work |
|
|
154
|
+
| `pause` | state update | Marks work as paused |
|
|
155
|
+
| `continue` | orchestrator | Resumes paused work |
|
|
156
|
+
|
|
157
|
+
### Example Scenarios
|
|
158
|
+
|
|
159
|
+
**Scenario 1: Clear Feature Request**
|
|
160
|
+
```
|
|
161
|
+
User: /agentful build the authentication system
|
|
162
|
+
→ Intent: feature_request (confidence: 0.9)
|
|
163
|
+
→ Entities: feature "authentication system"
|
|
164
|
+
→ Route: orchestrator (FEATURE_DEVELOPMENT workflow)
|
|
165
|
+
→ No ambiguity, proceed immediately
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Scenario 2: Ambiguous Reference**
|
|
169
|
+
```
|
|
170
|
+
User: /agentful fix it
|
|
171
|
+
→ Intent: bug_report (confidence: 0.7)
|
|
172
|
+
→ Entities: none (pronoun "it" without referent)
|
|
173
|
+
→ Ambiguity: HIGH (pronoun_without_antecedent)
|
|
174
|
+
→ Response: "I want to make sure I understand correctly. What specifically would you like me to fix?"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Scenario 3: Reference Resolution**
|
|
178
|
+
```
|
|
179
|
+
User: /agentful update it to use OAuth
|
|
180
|
+
Context: Currently working on "login feature"
|
|
181
|
+
→ Resolve: "it" → "login feature"
|
|
182
|
+
→ Intent: feature_request (confidence: 0.85)
|
|
183
|
+
→ Entities: feature "login", action "update to use OAuth"
|
|
184
|
+
→ Route: orchestrator (FEATURE_DEVELOPMENT workflow)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Scenario 4: Status Check**
|
|
188
|
+
```
|
|
189
|
+
User: /agentful what's the status?
|
|
190
|
+
→ Intent: status_update (confidence: 0.95)
|
|
191
|
+
→ Route: product-tracking skill
|
|
192
|
+
→ Shows completion percentage, current work, blocked items
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Scenario 5: Mind Change**
|
|
196
|
+
```
|
|
197
|
+
User: /agentful actually never mind, let's do the dashboard instead
|
|
198
|
+
→ Mind change detected: HIGH confidence
|
|
199
|
+
→ Reset context: clear current feature
|
|
200
|
+
→ Intent: feature_request (confidence: 0.9)
|
|
201
|
+
→ Entities: feature "dashboard"
|
|
202
|
+
→ Route: orchestrator (FEATURE_DEVELOPMENT workflow)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Scenario 6: Context Loss**
|
|
206
|
+
```
|
|
207
|
+
User: /agentful continue with that
|
|
208
|
+
Last message: 48 hours ago
|
|
209
|
+
→ Context loss detected: STALE
|
|
210
|
+
→ Response: "It's been 48 hours since our last conversation. We were working on the login feature. Would you like to continue with that, or would you prefer to start something new?"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Quick Reference
|
|
216
|
+
|
|
217
|
+
Human-in-the-loop product development with Claude Code.
|
|
9
218
|
|
|
10
219
|
## What It Does
|
|
11
220
|
|
|
@@ -13,7 +222,7 @@ agentful transforms product specifications into working software by:
|
|
|
13
222
|
|
|
14
223
|
1. **Understanding your stack** - Auto-detects languages, frameworks, patterns
|
|
15
224
|
2. **Planning the work** - Organizes features into domains and priorities
|
|
16
|
-
3. **Building
|
|
225
|
+
3. **Building with guidance** - Specialized agents implement, test, validate with human checkpoints
|
|
17
226
|
4. **Ensuring quality** - Automatic code review, testing, security checks
|
|
18
227
|
5. **Tracking progress** - Real-time completion metrics and state
|
|
19
228
|
|
|
@@ -25,7 +234,7 @@ agentful transforms product specifications into working software by:
|
|
|
25
234
|
# Install in your project
|
|
26
235
|
npx @itz4blitz/agentful init
|
|
27
236
|
|
|
28
|
-
# Start
|
|
237
|
+
# Start structured development
|
|
29
238
|
/agentful-start
|
|
30
239
|
|
|
31
240
|
# Monitor progress
|
|
@@ -36,7 +245,7 @@ npx @itz4blitz/agentful init
|
|
|
36
245
|
|
|
37
246
|
| Command | What It Does |
|
|
38
247
|
|---------|--------------|
|
|
39
|
-
| `/agentful-start` | Start
|
|
248
|
+
| `/agentful-start` | Start structured development loop |
|
|
40
249
|
| `/agentful-status` | Show completion percentage, current work |
|
|
41
250
|
| `/agentful-validate` | Run quality gates (tests, lint, security) |
|
|
42
251
|
| `/agentful-decide` | Answer blocking decisions |
|
|
@@ -250,15 +459,15 @@ When agentful needs input:
|
|
|
250
459
|
|
|
251
460
|
| Type | Trigger | Workflow |
|
|
252
461
|
|------|---------|----------|
|
|
253
|
-
| **Feature** | "Build X", "Add Y feature" |
|
|
462
|
+
| **Feature** | "Build X", "Add Y feature" | Iterative loop with human checkpoints until complete |
|
|
254
463
|
| **Bugfix** | "Fix X bug", "Y is broken" | Quick fix → test → validate → stop |
|
|
255
464
|
| **Enhancement** | "Add X to Y", "Enhance Z" | Enhance → test → validate → stop |
|
|
256
465
|
| **Refactor** | "Refactor X", "Improve Y code" | Refactor → test → validate → stop |
|
|
257
466
|
| **Maintenance** | "Update deps", "Security scan" | Update → test → validate → stop |
|
|
258
467
|
|
|
259
|
-
##
|
|
468
|
+
## Extended Development Sessions
|
|
260
469
|
|
|
261
|
-
For
|
|
470
|
+
For longer development sessions with fewer interruptions, use the **Ralph Wiggum plugin** (requires separate installation):
|
|
262
471
|
|
|
263
472
|
```bash
|
|
264
473
|
/ralph-loop "/agentful-start" \
|
|
@@ -268,10 +477,10 @@ For 24/7 autonomous development, use the **Ralph Wiggum plugin** (requires separ
|
|
|
268
477
|
|
|
269
478
|
> **Note**: `/ralph-loop` is an external plugin command from the Ralph Wiggum plugin. Install separately from the Claude Code plugin registry.
|
|
270
479
|
|
|
271
|
-
|
|
480
|
+
Pauses when:
|
|
481
|
+
- Human decisions are needed
|
|
272
482
|
- All features complete (100%)
|
|
273
|
-
-
|
|
274
|
-
- Quality gates fail (pauses for review)
|
|
483
|
+
- Quality gates fail (requires review)
|
|
275
484
|
|
|
276
485
|
## Best Practices
|
|
277
486
|
|
|
@@ -281,7 +490,7 @@ Stops when:
|
|
|
281
490
|
- Group related features into domains (for complex projects)
|
|
282
491
|
|
|
283
492
|
**2. Answer Decisions Promptly**
|
|
284
|
-
- Decisions block the
|
|
493
|
+
- Decisions block the development loop
|
|
285
494
|
- Use `/agentful-decide` to resolve multiple at once
|
|
286
495
|
|
|
287
496
|
**3. Review Commits**
|
|
@@ -341,4 +550,4 @@ It learns **your project's patterns** and generates agents that match your conve
|
|
|
341
550
|
- **Documentation**: https://agentful.app
|
|
342
551
|
- **GitHub**: https://github.com/itz4blitz/agentful
|
|
343
552
|
- **Issues**: https://github.com/itz4blitz/agentful/issues
|
|
344
|
-
- **Version**: 0.1.
|
|
553
|
+
- **Version**: 0.1.11 (check updates: `npm outdated @itz4blitz/agentful`)
|
package/.claude/settings.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"includeCoAuthoredBy": false,
|
|
3
3
|
"hooks": {
|
|
4
|
+
"SessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "bash bin/hooks/health-check.sh",
|
|
10
|
+
"timeout": 5,
|
|
11
|
+
"description": "Quick agentful health check"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
4
16
|
"PreToolUse": [
|
|
5
17
|
{
|
|
6
18
|
"matcher": "Write|Edit",
|
|
@@ -13,6 +25,17 @@
|
|
|
13
25
|
}
|
|
14
26
|
],
|
|
15
27
|
"PostToolUse": [
|
|
28
|
+
{
|
|
29
|
+
"matcher": "Write|Edit",
|
|
30
|
+
"hooks": [
|
|
31
|
+
{
|
|
32
|
+
"type": "command",
|
|
33
|
+
"command": "bash bin/hooks/analyze-trigger.sh",
|
|
34
|
+
"timeout": 3,
|
|
35
|
+
"description": "Check if file changes warrant analysis"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
16
39
|
{
|
|
17
40
|
"matcher": "Write|Edit",
|
|
18
41
|
"hooks": [
|
|
@@ -37,7 +60,8 @@
|
|
|
37
60
|
"hooks": [
|
|
38
61
|
{
|
|
39
62
|
"type": "command",
|
|
40
|
-
"command": "if [ -f .agentful/state.json ]; then jq -r '.current_phase // \"idle\"' .agentful/state.json 2>/dev/null || echo 'idle'; else echo 'idle'; fi"
|
|
63
|
+
"command": "if [ -f .agentful/state.json ]; then jq -r '.current_phase // \"idle\"' .agentful/state.json 2>/dev/null || echo 'idle'; else echo 'idle'; fi",
|
|
64
|
+
"description": "Track current agentful phase"
|
|
41
65
|
}
|
|
42
66
|
]
|
|
43
67
|
}
|
|
@@ -9,6 +9,26 @@ tools: Read, Write, Edit, Glob, Grep
|
|
|
9
9
|
|
|
10
10
|
This skill provides natural language processing capabilities for understanding user intent, managing conversation context, resolving references, and maintaining conversation history.
|
|
11
11
|
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
This skill is invoked when:
|
|
15
|
+
- User runs `/agentful <text>` with natural language input
|
|
16
|
+
- Any command receives ambiguous or unclear input
|
|
17
|
+
- Need to resolve pronouns or references from conversation history
|
|
18
|
+
- Need to classify user intent before routing to handlers
|
|
19
|
+
|
|
20
|
+
**Entry Point**: The `/agentful` command delegates to this skill for all natural language processing.
|
|
21
|
+
|
|
22
|
+
## Responsibilities
|
|
23
|
+
|
|
24
|
+
1. **Intent Classification** - Determine what the user wants (feature, bug fix, status, etc.)
|
|
25
|
+
2. **Reference Resolution** - Resolve "it", "that", "this" to actual feature names
|
|
26
|
+
3. **Entity Extraction** - Extract features, domains, subtasks mentioned
|
|
27
|
+
4. **Ambiguity Detection** - Identify unclear requests and ask clarifying questions
|
|
28
|
+
5. **Context Management** - Track conversation state, detect context loss
|
|
29
|
+
6. **Routing** - Route to appropriate handler (orchestrator, status, validate, etc.)
|
|
30
|
+
7. **History Tracking** - Maintain conversation history for context
|
|
31
|
+
|
|
12
32
|
## Core Functions
|
|
13
33
|
|
|
14
34
|
### 1. Intent Classification
|
|
@@ -796,6 +816,221 @@ function get_recent_context(
|
|
|
796
816
|
}
|
|
797
817
|
```
|
|
798
818
|
|
|
819
|
+
## Routing Logic
|
|
820
|
+
|
|
821
|
+
### Route to Handler
|
|
822
|
+
|
|
823
|
+
```typescript
|
|
824
|
+
/**
|
|
825
|
+
* Determine which handler should process the classified intent
|
|
826
|
+
* @param intent - Classified intent from user message
|
|
827
|
+
* @param entities - Extracted entities (features, domains, etc.)
|
|
828
|
+
* @param state - Current conversation state
|
|
829
|
+
* @returns Routing decision with handler and context
|
|
830
|
+
*/
|
|
831
|
+
function route_to_handler(
|
|
832
|
+
intent: IntentClassification,
|
|
833
|
+
entities: FeatureMention,
|
|
834
|
+
state: ConversationState
|
|
835
|
+
): RoutingDecision {
|
|
836
|
+
const intentName = intent.intent;
|
|
837
|
+
|
|
838
|
+
// Feature development or bug fixes → orchestrator
|
|
839
|
+
if (intentName === 'feature_request' || intentName === 'bug_report') {
|
|
840
|
+
return {
|
|
841
|
+
handler: 'orchestrator',
|
|
842
|
+
skill: null,
|
|
843
|
+
context: {
|
|
844
|
+
intent: intentName,
|
|
845
|
+
message: entities.feature_name
|
|
846
|
+
? `User wants to ${intentName === 'feature_request' ? 'build' : 'fix'} ${entities.feature_name}`
|
|
847
|
+
: 'User has a request that needs classification',
|
|
848
|
+
feature_id: entities.feature_id,
|
|
849
|
+
domain_id: entities.domain_id,
|
|
850
|
+
work_type: intentName === 'feature_request' ? 'FEATURE_DEVELOPMENT' : 'BUGFIX'
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
// Status inquiries → product-tracking skill
|
|
856
|
+
if (intentName === 'status_update') {
|
|
857
|
+
return {
|
|
858
|
+
handler: 'product-tracking',
|
|
859
|
+
skill: 'product-tracking',
|
|
860
|
+
context: {
|
|
861
|
+
intent: intentName,
|
|
862
|
+
feature_filter: entities.feature_id || null,
|
|
863
|
+
domain_filter: entities.domain_id || null
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// Validation requests → validation skill
|
|
869
|
+
if (/test|validate|check/i.test(intentName)) {
|
|
870
|
+
return {
|
|
871
|
+
handler: 'validation',
|
|
872
|
+
skill: 'validation',
|
|
873
|
+
context: {
|
|
874
|
+
intent: intentName,
|
|
875
|
+
scope: entities.feature_id ? 'feature' : 'all'
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// Decision handling → decision-handler
|
|
881
|
+
if (intentName === 'decision' || /decide|choice|option/i.test(intentName)) {
|
|
882
|
+
return {
|
|
883
|
+
handler: 'decision-handler',
|
|
884
|
+
skill: null,
|
|
885
|
+
context: {
|
|
886
|
+
intent: intentName
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
// Product planning → product-planning skill
|
|
892
|
+
if (/plan|requirements|spec|analyze/i.test(intentName)) {
|
|
893
|
+
return {
|
|
894
|
+
handler: 'product-planning',
|
|
895
|
+
skill: 'product-planning',
|
|
896
|
+
context: {
|
|
897
|
+
intent: intentName
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
// Approval/continue → orchestrator (resume current work)
|
|
903
|
+
if (intentName === 'approval' || intentName === 'continue') {
|
|
904
|
+
return {
|
|
905
|
+
handler: 'orchestrator',
|
|
906
|
+
skill: null,
|
|
907
|
+
context: {
|
|
908
|
+
intent: 'continue',
|
|
909
|
+
message: 'User approved or wants to continue current work',
|
|
910
|
+
resume_feature: state.current_feature
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// Rejection/stop → update state, don't delegate
|
|
916
|
+
if (intentName === 'rejection' || intentName === 'pause') {
|
|
917
|
+
return {
|
|
918
|
+
handler: 'inline',
|
|
919
|
+
skill: null,
|
|
920
|
+
context: {
|
|
921
|
+
intent: intentName,
|
|
922
|
+
action: 'pause_work'
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// Questions/clarifications → handle inline
|
|
928
|
+
if (intentName === 'question' || intentName === 'clarification') {
|
|
929
|
+
return {
|
|
930
|
+
handler: 'inline',
|
|
931
|
+
skill: null,
|
|
932
|
+
context: {
|
|
933
|
+
intent: intentName,
|
|
934
|
+
answer_from: ['conversation_history', 'product_spec', 'completion_status']
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// Default: handle inline or ask for clarification
|
|
940
|
+
return {
|
|
941
|
+
handler: 'inline',
|
|
942
|
+
skill: null,
|
|
943
|
+
context: {
|
|
944
|
+
intent: intentName,
|
|
945
|
+
needs_clarification: true
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
interface RoutingDecision {
|
|
951
|
+
handler: 'orchestrator' | 'product-tracking' | 'validation' | 'decision-handler' | 'product-planning' | 'inline';
|
|
952
|
+
skill: string | null; // Skill name for Task delegation
|
|
953
|
+
context: {
|
|
954
|
+
intent: string;
|
|
955
|
+
message?: string;
|
|
956
|
+
feature_id?: string;
|
|
957
|
+
domain_id?: string;
|
|
958
|
+
work_type?: string;
|
|
959
|
+
[key: string]: any;
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
```
|
|
963
|
+
|
|
964
|
+
### Execute Routing
|
|
965
|
+
|
|
966
|
+
```typescript
|
|
967
|
+
/**
|
|
968
|
+
* Execute the routing decision
|
|
969
|
+
* @param routing - Routing decision from route_to_handler
|
|
970
|
+
* @param userMessage - Original user message
|
|
971
|
+
* @param resolved - Resolved message with references expanded
|
|
972
|
+
*/
|
|
973
|
+
function execute_routing(
|
|
974
|
+
routing: RoutingDecision,
|
|
975
|
+
userMessage: string,
|
|
976
|
+
resolved: ResolvedMessage
|
|
977
|
+
): void {
|
|
978
|
+
switch (routing.handler) {
|
|
979
|
+
case 'orchestrator':
|
|
980
|
+
// Delegate to orchestrator agent
|
|
981
|
+
Task('orchestrator',
|
|
982
|
+
`${routing.context.message || userMessage}
|
|
983
|
+
|
|
984
|
+
Work Type: ${routing.context.work_type || 'FEATURE_DEVELOPMENT'}
|
|
985
|
+
${routing.context.feature_id ? `Feature: ${routing.context.feature_id}` : ''}
|
|
986
|
+
${routing.context.domain_id ? `Domain: ${routing.context.domain_id}` : ''}
|
|
987
|
+
|
|
988
|
+
Classify and execute appropriate workflow.`
|
|
989
|
+
);
|
|
990
|
+
break;
|
|
991
|
+
|
|
992
|
+
case 'product-tracking':
|
|
993
|
+
// Delegate to product-tracking skill
|
|
994
|
+
Task('product-tracking',
|
|
995
|
+
`Show status and progress.
|
|
996
|
+
${routing.context.feature_filter ? `Filter: feature ${routing.context.feature_filter}` : ''}
|
|
997
|
+
${routing.context.domain_filter ? `Filter: domain ${routing.context.domain_filter}` : ''}`
|
|
998
|
+
);
|
|
999
|
+
break;
|
|
1000
|
+
|
|
1001
|
+
case 'validation':
|
|
1002
|
+
// Delegate to validation skill
|
|
1003
|
+
Task('validation',
|
|
1004
|
+
`Run quality gates.
|
|
1005
|
+
Scope: ${routing.context.scope || 'all'}`
|
|
1006
|
+
);
|
|
1007
|
+
break;
|
|
1008
|
+
|
|
1009
|
+
case 'decision-handler':
|
|
1010
|
+
// For now, show how to use /agentful-decide
|
|
1011
|
+
return `You have pending decisions. Run \`/agentful-decide\` to review and resolve them.`;
|
|
1012
|
+
break;
|
|
1013
|
+
|
|
1014
|
+
case 'product-planning':
|
|
1015
|
+
// Delegate to product-planning skill
|
|
1016
|
+
Task('product-planning', userMessage);
|
|
1017
|
+
break;
|
|
1018
|
+
|
|
1019
|
+
case 'inline':
|
|
1020
|
+
// Handle inline (no delegation needed)
|
|
1021
|
+
if (routing.context.needs_clarification) {
|
|
1022
|
+
return generate_clarification_response(userMessage, routing.context);
|
|
1023
|
+
} else if (routing.context.action === 'pause_work') {
|
|
1024
|
+
pause_current_work();
|
|
1025
|
+
return 'Work paused. Run `/agentful` with your next request when ready to continue.';
|
|
1026
|
+
} else if (routing.context.intent === 'question') {
|
|
1027
|
+
return answer_question(userMessage, routing.context);
|
|
1028
|
+
}
|
|
1029
|
+
break;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
```
|
|
1033
|
+
|
|
799
1034
|
## Integration with Orchestrator
|
|
800
1035
|
|
|
801
1036
|
### Delegation Interface
|
|
@@ -1037,9 +1272,9 @@ interface StaleContextResponse {
|
|
|
1037
1272
|
// Complete conversation processing flow
|
|
1038
1273
|
async function process_conversation(userMessage: string): Promise<ConversationResponse> {
|
|
1039
1274
|
// 1. Load conversation state and history
|
|
1040
|
-
const state = load_conversation_state();
|
|
1041
|
-
const history = read_conversation_history();
|
|
1042
|
-
const productSpec = load_product_spec();
|
|
1275
|
+
const state = load_conversation_state('.agentful/conversation-state.json');
|
|
1276
|
+
const history = read_conversation_history('.agentful/conversation-history.json');
|
|
1277
|
+
const productSpec = load_product_spec('.claude/product/');
|
|
1043
1278
|
|
|
1044
1279
|
// 2. Check for context loss
|
|
1045
1280
|
const contextRecovery = detect_context_loss(history.messages, state);
|
|
@@ -1079,8 +1314,8 @@ async function process_conversation(userMessage: string): Promise<ConversationRe
|
|
|
1079
1314
|
};
|
|
1080
1315
|
}
|
|
1081
1316
|
|
|
1082
|
-
// 8.
|
|
1083
|
-
const
|
|
1317
|
+
// 8. Route to appropriate handler
|
|
1318
|
+
const routing = route_to_handler(intent, entities, state);
|
|
1084
1319
|
|
|
1085
1320
|
// 9. Add user message to history
|
|
1086
1321
|
add_message_to_history({
|
|
@@ -1089,24 +1324,66 @@ async function process_conversation(userMessage: string): Promise<ConversationRe
|
|
|
1089
1324
|
intent: intent.intent,
|
|
1090
1325
|
entities: entities,
|
|
1091
1326
|
references_resolved: resolved.references
|
|
1092
|
-
});
|
|
1093
|
-
|
|
1094
|
-
// 10.
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1327
|
+
}, '.agentful/conversation-history.json');
|
|
1328
|
+
|
|
1329
|
+
// 10. Execute routing
|
|
1330
|
+
execute_routing(routing, userMessage, resolved);
|
|
1331
|
+
|
|
1332
|
+
// 11. Update conversation state
|
|
1333
|
+
state.last_message_time = new Date().toISOString();
|
|
1334
|
+
state.message_count++;
|
|
1335
|
+
if (entities.feature_id) {
|
|
1336
|
+
state.current_feature = {
|
|
1337
|
+
feature_id: entities.feature_id,
|
|
1338
|
+
feature_name: entities.feature_name,
|
|
1339
|
+
domain_id: entities.domain_id
|
|
1100
1340
|
};
|
|
1101
1341
|
}
|
|
1342
|
+
save_conversation_state(state);
|
|
1102
1343
|
|
|
1103
1344
|
return {
|
|
1104
|
-
type: '
|
|
1105
|
-
|
|
1345
|
+
type: 'routed',
|
|
1346
|
+
handler: routing.handler,
|
|
1347
|
+
context: routing.context
|
|
1106
1348
|
};
|
|
1107
1349
|
}
|
|
1108
1350
|
```
|
|
1109
1351
|
|
|
1352
|
+
### Complete Flow Diagram
|
|
1353
|
+
|
|
1354
|
+
```
|
|
1355
|
+
User Input
|
|
1356
|
+
↓
|
|
1357
|
+
Load State & History
|
|
1358
|
+
↓
|
|
1359
|
+
Context Loss Check ──→ [STALE] ──→ Confirm & Resume
|
|
1360
|
+
↓ [FRESH]
|
|
1361
|
+
Mind Change Detection ──→ [DETECTED] ──→ Reset Context
|
|
1362
|
+
↓ [CONTINUE]
|
|
1363
|
+
Reference Resolution
|
|
1364
|
+
↓
|
|
1365
|
+
Intent Classification
|
|
1366
|
+
↓
|
|
1367
|
+
Entity Extraction
|
|
1368
|
+
↓
|
|
1369
|
+
Ambiguity Detection ──→ [AMBIGUOUS] ──→ Ask Clarifying Question
|
|
1370
|
+
↓ [CLEAR]
|
|
1371
|
+
Route to Handler
|
|
1372
|
+
↓
|
|
1373
|
+
├─→ [orchestrator] ──→ Task('orchestrator', context)
|
|
1374
|
+
├─→ [product-tracking] ──→ Task('product-tracking', context)
|
|
1375
|
+
├─→ [validation] ──→ Task('validation', context)
|
|
1376
|
+
├─→ [decision-handler] ──→ Show /agentful-decide
|
|
1377
|
+
├─→ [product-planning] ──→ Task('product-planning', context)
|
|
1378
|
+
└─→ [inline] ──→ Generate Response Directly
|
|
1379
|
+
↓
|
|
1380
|
+
Add to History
|
|
1381
|
+
↓
|
|
1382
|
+
Update State
|
|
1383
|
+
↓
|
|
1384
|
+
Done
|
|
1385
|
+
```
|
|
1386
|
+
|
|
1110
1387
|
## File Locations
|
|
1111
1388
|
|
|
1112
1389
|
```
|