@itz4blitz/agentful 0.2.1 → 0.3.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.
@@ -1,668 +0,0 @@
1
- ---
2
- name: agentful-agents
3
- description: Discover domain patterns and generate specialized domain agents with comprehensive documentation
4
- ---
5
-
6
- # agentful Agents
7
-
8
- This command discovers domain patterns in your codebase and generates specialized domain agents with validation and documentation.
9
-
10
- ## What It Does
11
-
12
- 1. **Discovers domain patterns** by analyzing code cohesion (NOT hardcoded terms)
13
- 2. **Identifies logical domains** based on actual project structure
14
- 3. **Checks existing agents** for gaps or missing coverage
15
- 4. **Presents findings** with confidence scores
16
- 5. **Asks for confirmation** before generating anything
17
- 6. **Generates agents in parallel** with validation and documentation
18
-
19
- ## Auto-Detection Process
20
-
21
- ```bash
22
- # Step 1: Check current state
23
- has_code = check_codebase_exists()
24
- has_architecture = exists(".agentful/architecture.json")
25
-
26
- if !has_code:
27
- mode = "NO_CODEBASE"
28
- goto NO_CODEBASE_MODE
29
-
30
- if !has_architecture:
31
- mode = "NEED_ARCHITECTURE"
32
- goto NEED_ARCHITECTURE_MODE
33
-
34
- # Step 2: Run domain discovery
35
- mode = "DISCOVERY"
36
- goto DISCOVERY_MODE
37
- ```
38
-
39
- ---
40
-
41
- ## Mode 1: NO_CODEBASE (No Code to Analyze)
42
-
43
- When no substantial codebase exists.
44
-
45
- ```
46
- ⚠️ No Codebase Detected
47
-
48
- I can't discover domain agents because there's no code to analyze yet.
49
-
50
- Options:
51
- [1] Start building features first (Run /agentful-start)
52
- [2] Manually define domains
53
- [3] Skip for now
54
-
55
- Your choice: > _______________________________
56
- ```
57
-
58
- ---
59
-
60
- ## Mode 2: NEED_ARCHITECTURE (Missing Architecture Analysis)
61
-
62
- When `.agentful/architecture.json` doesn't exist.
63
-
64
- ```
65
- 🔍 Architecture Analysis Needed
66
-
67
- Before discovering domain agents, I need to understand your tech stack
68
- and code patterns.
69
-
70
- Run /agentful-start first, which will:
71
- 1. Trigger architect agent to analyze your project
72
- 2. Generate tech stack agents
73
- 3. Then you can run /agentful-agents to discover domain agents
74
-
75
- Would you like to run /agentful-start now? (y/n): > _______________________________
76
- ```
77
-
78
- ---
79
-
80
- ## Mode 3: DISCOVERY (Main Workflow)
81
-
82
- When codebase exists and architecture analyzed.
83
-
84
- ### Step 1: Explore Codebase for Domain Patterns
85
-
86
- Use **parallel explorer agents** to analyze different aspects:
87
-
88
- ```bash
89
- # Launch parallel exploration tasks
90
- Task("domain-explorer-cohesion", "Analyze code cohesion to identify logical domains based on file groupings and dependencies.")
91
-
92
- Task("domain-explorer-naming", "Analyze naming patterns to identify business domain terminology.")
93
-
94
- Task("domain-explorer-database", "Analyze database schemas and models to identify data domains.")
95
-
96
- Task("domain-explorer-api", "Analyze API routes and endpoints to identify domain boundaries.")
97
- ```
98
-
99
- **Explorer Agent Guidelines:**
100
-
101
- 1. **Cohesion Explorer**:
102
- - Looks for file clusters with high internal coupling
103
- - Analyzes import graphs
104
- - Outputs confidence based on coupling strength
105
-
106
- 2. **Naming Explorer**:
107
- - Scans for business domain terms
108
- - Detects consistent naming patterns
109
- - Outputs confidence based on naming consistency
110
-
111
- 3. **Database Explorer**:
112
- - Analyzes database schemas/models
113
- - Identifies entity relationships
114
- - Outputs confidence based on entity cohesion
115
-
116
- 4. **API Explorer**:
117
- - Maps API routes to business capabilities
118
- - Identifies controller/handler groupings
119
- - Outputs confidence based on route organization
120
-
121
- **Explorer Output Format:**
122
-
123
- ```json
124
- {
125
- "explorer": "cohesion",
126
- "domains_found": [
127
- {
128
- "name": "billing",
129
- "confidence": 0.87,
130
- "evidence": [
131
- "Cohesive file cluster in src/billing/",
132
- "15 files with high internal coupling",
133
- "Shared imports: stripe, payments, invoices"
134
- ],
135
- "files": [
136
- "src/billing/subscription.service.ts",
137
- "src/billing/invoice.service.ts"
138
- ]
139
- }
140
- ]
141
- }
142
- ```
143
-
144
- ### Step 2: Aggregate and Validate Findings
145
-
146
- After all explorers complete, **aggregate their results**:
147
-
148
- ```bash
149
- Task("domain-validator", "Aggregate findings from all explorers. Merge overlapping domains. Validate each domain has sufficient evidence. Check against existing agents to identify gaps.")
150
- ```
151
-
152
- **Validator Agent Guidelines:**
153
-
154
- 1. **Merge overlapping domains**:
155
- - If "billing" found by 3 explorers → strong signal
156
- - If single file detected as domain → probably false positive
157
-
158
- 2. **Calculate composite confidence**:
159
- ```
160
- confidence = (
161
- cohesion_score * 0.3 +
162
- naming_score * 0.2 +
163
- database_score * 0.3 +
164
- api_score * 0.2
165
- )
166
-
167
- Only include if confidence >= 0.6
168
- ```
169
-
170
- 3. **Check existing agents**:
171
- - Read `.claude/agents/` directory
172
- - Identify which domains already have agents
173
- - Flag gaps where domain exists but no agent
174
-
175
- **Validator Output Format:**
176
-
177
- ```json
178
- {
179
- "discovered_domains": [
180
- {
181
- "name": "billing",
182
- "confidence": 0.89,
183
- "sources": ["cohesion", "naming", "database", "api"],
184
- "has_existing_agent": false,
185
- "recommendation": "CREATE_AGENT"
186
- },
187
- {
188
- "name": "authentication",
189
- "confidence": 0.92,
190
- "has_existing_agent": true,
191
- "recommendation": "SKIP"
192
- }
193
- ]
194
- }
195
- ```
196
-
197
- ### Step 3: Present Findings to User
198
-
199
- Display comprehensive analysis:
200
-
201
- ```
202
- 🔍 Domain Discovery Complete
203
-
204
- ════════════════════════════════════════════════════════
205
-
206
- 📊 Domains Discovered
207
-
208
- 1. billing ████████░░ 89%
209
- Evidence:
210
- • 15 cohesive files in src/billing/
211
- • Clear API boundaries (/api/billing/*)
212
- • Dedicated database tables
213
- • Consistent naming (BillingService, InvoiceController)
214
-
215
- Files: subscription.service.ts, invoice.service.ts, payment.controller.ts
216
- Status: No agent exists
217
- Recommendation: CREATE AGENT
218
-
219
- 2. inventory ██████████ 94%
220
- Evidence:
221
- • 22 files in src/inventory/
222
- • Complex API structure (/api/inventory/*)
223
- • 8 database models
224
- • High internal coupling
225
-
226
- Status: No agent exists
227
- Recommendation: CREATE AGENT
228
-
229
- 3. authentication █████████░ 87%
230
- Evidence:
231
- • 8 files in src/auth/
232
- • Well-defined API (/api/auth/*)
233
-
234
- Status: ✅ Agent exists (.claude/agents/auth.md)
235
- Recommendation: SKIP
236
-
237
- ════════════════════════════════════════════════════════
238
-
239
- 📋 Summary
240
-
241
- Domains to create agents for:
242
- • billing (89% confidence)
243
- • inventory (94% confidence)
244
-
245
- Existing domain agents:
246
- • authentication (already covered)
247
-
248
- ════════════════════════════════════════════════════════
249
-
250
- Would you like to generate agents for the discovered domains?
251
-
252
- This will create:
253
- • .claude/agents/billing.md
254
- • .claude/agents/inventory.md
255
-
256
- Generate agents? (y/n): > _______________________________
257
- ```
258
-
259
- ### Step 4: Generate Agents (If Confirmed)
260
-
261
- If user confirms, use **parallel generator agents**:
262
-
263
- ```bash
264
- # For each domain, spawn parallel generators
265
- Task("agent-generator-billing", "Generate .claude/agents/billing.md by analyzing src/billing/ code patterns.")
266
-
267
- Task("agent-generator-inventory", "Generate .claude/agents/inventory.md by analyzing src/inventory/ code patterns.")
268
-
269
- # Validate all generated agents
270
- Task("agent-validator", "Validate all newly generated agents.")
271
- ```
272
-
273
- **Generator Agent Guidelines:**
274
-
275
- For each domain agent being generated:
276
-
277
- 1. **Analyze domain files**:
278
- ```bash
279
- Read("src/billing/subscription.service.ts")
280
- Read("src/billing/invoice.service.ts")
281
- Read("src/billing/payment.controller.ts")
282
- ```
283
-
284
- 2. **Extract real examples** (NEVER use placeholders):
285
- ```markdown
286
- ## Real Examples from This Project
287
-
288
- ```typescript
289
- // Actual pattern from src/billing/subscription.service.ts
290
- export class SubscriptionService {
291
- async createSubscription(userId: string, planId: string) {
292
- const plan = await this.plans.findById(planId);
293
- const customer = await this.stripe.customers.create({
294
- metadata: { userId }
295
- });
296
- // ... actual implementation
297
- }
298
- }
299
- ```
300
- ```
301
-
302
- 3. **Document domain-specific rules**:
303
- ```markdown
304
- ## Business Rules
305
-
306
- 1. **Subscription Lifecycle**:
307
- - All subscriptions must have a Stripe subscription ID
308
- - Status changes: trial → active → past_due → canceled
309
- - Cancellations are soft deletes
310
-
311
- 2. **Proration**:
312
- - Always use Stripe's built-in proration
313
- - Never calculate proration manually
314
- ```
315
-
316
- 4. **Follow agent template structure**:
317
- ```markdown
318
- ---
319
- name: billing
320
- description: Handles all billing, subscriptions, and payment logic
321
- model: sonnet
322
- tools: Read, Write, Edit, Glob, Grep, Bash
323
- ---
324
-
325
- # Billing Agent
326
-
327
- You implement billing features for this project.
328
-
329
- ## Your Scope
330
-
331
- - Subscription management (create, update, cancel)
332
- - Invoice generation and handling
333
- - Payment processing via Stripe
334
- - Webhook handling for Stripe events
335
-
336
- ## NOT Your Scope
337
-
338
- - User authentication → @backend or @auth
339
- - Frontend components → @frontend
340
- - Tests → @tester
341
-
342
- ## Project-Specific Patterns
343
-
344
- [Real patterns extracted from code]
345
-
346
- ## Real Examples from This Project
347
-
348
- [Real code examples]
349
-
350
- ## Business Rules
351
-
352
- [Domain-specific rules]
353
-
354
- ## Integration Patterns
355
-
356
- [How this domain integrates with others]
357
-
358
- ## Rules
359
-
360
- 1. ALWAYS follow patterns from real examples
361
- 2. NEVER introduce new patterns without user approval
362
- 3. ALWAYS use Stripe for payment processing
363
- 4. ALWAYS handle webhook idempotency
364
- ```
365
-
366
- **Validator Agent Guidelines:**
367
-
368
- After generation, validate each agent:
369
-
370
- 1. **Structural validation**:
371
- - Has frontmatter with name, description, model, tools
372
- - Has clear sections: Scope, Patterns, Examples, Rules
373
- - Markdown is well-formed
374
-
375
- 2. **Content validation**:
376
- - Contains REAL examples (not placeholders)
377
- - Examples are from actual project files
378
- - Patterns match project conventions
379
-
380
- 3. **Completeness validation**:
381
- - Domain boundaries clearly defined
382
- - Integration patterns documented
383
- - Error handling covered
384
-
385
- If validation fails, **regenerate** that agent.
386
-
387
- ### Step 5: Display Results
388
-
389
- After all agents generated and validated:
390
-
391
- ```
392
- ✅ Domain Agents Generated
393
-
394
- Created agents for 2 domains:
395
-
396
- • .claude/agents/billing.md ✓
397
- • .claude/agents/inventory.md ✓
398
-
399
- ════════════════════════════════════════════════════════
400
-
401
- 📋 Agent Summary
402
-
403
- Billing Agent:
404
- • Handles subscriptions, payments, invoices
405
- • Integrates with Stripe
406
- • 6 real code examples included
407
-
408
- Inventory Agent:
409
- • Manages products, stock, warehouses
410
- • Handles allocation and reservations
411
- • 8 real code examples included
412
-
413
- ════════════════════════════════════════════════════════
414
-
415
- 🎯 How to Use
416
-
417
- In your prompts, mention the domain agent:
418
-
419
- "Hey @billing, add a feature to pause subscriptions"
420
- "Hey @inventory, implement low-stock alerts"
421
-
422
- ════════════════════════════════════════════════════════
423
-
424
- Next Steps:
425
-
426
- 1. Review generated agents in .claude/agents/
427
- 2. Customize if needed
428
- 3. Run /agentful-start to use them in development
429
-
430
- ────────────────────────────────────────────────────────
431
-
432
- Updated architecture.json with discovered domains.
433
- ```
434
-
435
- ### Step 6: Update Architecture
436
-
437
- Update `.agentful/architecture.json`:
438
-
439
- ```json
440
- {
441
- "analysis_date": "2026-01-20T00:00:00Z",
442
- "domains": [
443
- {
444
- "name": "billing",
445
- "confidence": 0.89,
446
- "agent_path": ".claude/agents/billing.md",
447
- "file_count": 15,
448
- "key_files": ["src/billing/subscription.service.ts"],
449
- "external_services": ["Stripe"]
450
- },
451
- {
452
- "name": "inventory",
453
- "confidence": 0.94,
454
- "agent_path": ".claude/agents/inventory.md",
455
- "file_count": 22
456
- }
457
- ]
458
- }
459
- ```
460
-
461
- ---
462
-
463
- ## Re-running Discovery
464
-
465
- User can run `/agentful-agents` again to discover new domains as codebase grows:
466
-
467
- ```
468
- 🔍 Re-analyzing Domains
469
-
470
- Last discovery: 3 days ago
471
-
472
- Changes detected:
473
- • 12 new files in src/notifications/
474
- • New API routes: /api/notifications/*
475
-
476
- New domain discovered:
477
-
478
- 1. notifications ████████░░ 82%
479
- Status: No agent exists
480
- Recommendation: CREATE AGENT
481
-
482
- Would you like to generate an agent for notifications? (y/n)
483
- ```
484
-
485
- ---
486
-
487
- ## Agent Types Identified
488
-
489
- This command discovers:
490
-
491
- ### Domain Agents (Discovered)
492
-
493
- Based on actual code patterns:
494
- - **billing** - Subscription, payments, invoicing
495
- - **inventory** - Stock management, allocation
496
- - **authentication** - Login, sessions, tokens
497
- - **notifications** - Email, push, SMS
498
- - **content** - CMS, articles, media
499
- - **analytics** - Tracking, reporting
500
- - **messaging** - Chat, comments
501
- - **search** - Indexing, querying
502
- - **admin** - Admin panel, user management
503
-
504
- **Key:** Domains are DISCOVERED, not hardcoded.
505
-
506
- ### Missing Core Agents (Checked)
507
-
508
- Standard agentful agents that should exist:
509
- - `backend.md` - General backend implementation
510
- - `frontend.md` - General frontend implementation
511
- - `tester.md` - Test generation
512
- - `reviewer.md` - Code review
513
- - `fixer.md` - Bug fixes
514
- - `architect.md` - Tech stack analysis
515
- - `orchestrator.md` - Task coordination
516
-
517
- ---
518
-
519
- ## Output Structure
520
-
521
- Generated agents go in:
522
-
523
- ```
524
- .claude/agents/
525
- ├── billing.md # Domain agent
526
- ├── inventory.md # Domain agent
527
- └── [domain].md # More domains as discovered
528
- ```
529
-
530
- ---
531
-
532
- ## Example Flows
533
-
534
- ### Flow 1: First-Time Discovery
535
-
536
- ```
537
- User: /agentful-agents
538
-
539
- Command: → Detects codebase exists
540
- → Spawns 4 parallel explorers
541
- → Validator aggregates findings
542
- → Presents 3 domains discovered
543
- → 2 need agents, 1 already has agent
544
-
545
- User: [Confirms generation]
546
-
547
- Command: → Spawns 2 parallel generators
548
- → Spawns validator
549
- → All tasks complete
550
- → Displays results
551
- → Updates architecture.json
552
- ```
553
-
554
- ### Flow 2: No Codebase Yet
555
-
556
- ```
557
- User: /agentful-agents
558
-
559
- Command: → Detects no code exists
560
- → NO_CODEBASE mode
561
- → Shows options
562
-
563
- User: [Chooses option 1]
564
-
565
- Command: "Run /agentful-start to begin."
566
- ```
567
-
568
- ### Flow 3: Missing Architecture
569
-
570
- ```
571
- User: /agentful-agents
572
-
573
- Command: → Detects no architecture.json
574
- → NEED_ARCHITECTURE mode
575
- → Suggests /agentful-start
576
-
577
- User: [Confirms]
578
-
579
- Command: → Delegates to /agentful-start
580
- ```
581
-
582
- ### Flow 4: Re-Discovery
583
-
584
- ```
585
- User: /agentful-agents [Ran before, codebase grew]
586
-
587
- Command: → Detects previous discovery
588
- → Compares current vs last
589
- → Finds 1 new domain
590
- → Offers to generate agent
591
-
592
- User: [Confirms]
593
-
594
- Command: → Generates notification agent
595
- → Updates architecture.json
596
- ```
597
-
598
- ---
599
-
600
- ## Quality Checklist
601
-
602
- Generated agents must have:
603
-
604
- - [ ] Real code examples (NO placeholders)
605
- - [ ] Domain-specific business rules
606
- - [ ] Clear scope definition
607
- - [ ] Integration patterns
608
- - [ ] Error handling strategies
609
- - [ ] Database schema documentation
610
- - [ ] Proper markdown formatting
611
- - [ ] Valid frontmatter
612
-
613
- ---
614
-
615
- ## Important Rules
616
-
617
- 1. **NEVER hardcode domain names** - discover from code
618
- 2. **ALWAYS use parallel sub-agents** for exploration
619
- 3. **ALWAYS validate with user** before generating
620
- 4. **ALWAYS use real code examples** (never placeholders)
621
- 5. **ALWAYS validate generated agents** before reporting success
622
- 6. **NEVER assume** - if evidence is weak, flag as low confidence
623
- 7. **ALWAYS respect existing agents** - don't overwrite without asking
624
- 8. **ALWAYS update architecture.json** with discovery results
625
-
626
- ---
627
-
628
- ## Success Criteria
629
-
630
- This command succeeds when:
631
-
632
- 1. **Discovery**: Domains accurately identified from code patterns
633
- 2. **Validation**: User confirms findings before generation
634
- 3. **Generation**: All agents contain real examples from the project
635
- 4. **Validation**: All generated agents pass structural and content checks
636
- 5. **Integration**: Architecture updated with domain metadata
637
- 6. **Usability**: User can immediately use generated agents with @mentions
638
-
639
- ---
640
-
641
- ## Advanced: Custom Explorers
642
-
643
- Users can add custom exploration logic:
644
-
645
- Create `.agentful/explorers/custom-explorer.md`:
646
-
647
- ```markdown
648
- ---
649
- name: custom-domain-explorer
650
- description: Custom logic for discovering domains specific to this project
651
- ---
652
-
653
- # Custom Domain Explorer
654
-
655
- [User's custom exploration logic]
656
- ```
657
-
658
- The command will automatically detect and use custom explorers alongside built-in ones.
659
-
660
- ---
661
-
662
- ## Notes
663
-
664
- - Domain discovery is **heuristic-based** - confidence scores reflect uncertainty
665
- - Low confidence domains (< 60%) are filtered out
666
- - High confidence domains (> 85%) are strong candidates
667
- - Generated agents are **starting points** - users should customize
668
- - Re-run discovery as codebase evolves