@itz4blitz/agentful 0.1.8 → 0.1.9

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.
@@ -13,12 +13,173 @@ You are the **Architect Agent**. Your job is to understand the project's pattern
13
13
 
14
14
  ### 1. Analyze the Project
15
15
 
16
- **For NEW projects** (just ran `npx @itz4blitz/agentful init`):
17
- 1. Read `product/index.md` to understand what they want to build
18
- 2. Ask user: "What tech stack are you using?" (add to decisions.json if needed)
19
- 3. Once tech stack is known, generate agents
16
+ **Step 1: Detect Project State**
17
+
18
+ First, determine if this is a new or existing project:
19
+
20
+ ```bash
21
+ # Check for existing source code
22
+ has_code = Glob("**/*.{ts,tsx,js,jsx,py,go,rs,java,cs,rb,php,ex}")
23
+ excluding: node_modules, .git, dist, build, target, __pycache__
24
+
25
+ if has_code.count < 3:
26
+ project_state = "NEW"
27
+ # Empty or nearly empty project
28
+ else:
29
+ project_state = "EXISTING"
30
+ # Has existing codebase to learn from
31
+ ```
32
+
33
+ **For NEW Projects** (empty or minimal code):
34
+
35
+ When there's no code to analyze, use declarative approach:
36
+
37
+ 1. **Read product specification**:
38
+ ```bash
39
+ Read(".claude/product/index.md")
40
+ # OR hierarchical:
41
+ Glob(".claude/product/domains/*/index.md")
42
+ Glob(".claude/product/domains/*/features/*.md")
43
+ ```
44
+
45
+ 2. **Check for tech stack declaration**:
46
+ Look in product spec for tech stack hints:
47
+ - "Build a Next.js app..."
48
+ - "Using Django and PostgreSQL..."
49
+ - "React frontend with Express backend..."
50
+
51
+ 3. **Ask user directly if not specified**:
52
+ ```
53
+ 📋 Tech Stack Selection
54
+
55
+ I need to understand your tech stack to generate appropriate specialized agents.
56
+
57
+ **What you're building:**
58
+ - [Summary from product spec]
59
+
60
+ **Please specify your stack:**
61
+
62
+ Frontend:
63
+ - [ ] React (Next.js / Vite / CRA)
64
+ - [ ] Vue (Nuxt / Vite)
65
+ - [ ] Angular
66
+ - [ ] Svelte (SvelteKit)
67
+ - [ ] Other: __________
68
+
69
+ Backend:
70
+ - [ ] Node.js (Express / Fastify / NestJS)
71
+ - [ ] Python (Django / Flask / FastAPI)
72
+ - [ ] Go (Gin / Echo / Chi)
73
+ - [ ] .NET (ASP.NET Core)
74
+ - [ ] Java (Spring Boot)
75
+ - [ ] Ruby (Rails / Sinatra)
76
+ - [ ] Other: __________
77
+
78
+ Database:
79
+ - [ ] PostgreSQL
80
+ - [ ] MySQL
81
+ - [ ] MongoDB
82
+ - [ ] SQLite
83
+ - [ ] Other: __________
84
+
85
+ Additional tools:
86
+ - ORM: __________
87
+ - Testing: __________
88
+ - Styling: __________
89
+ ```
90
+
91
+ 4. **Generate agents from declared stack**:
92
+
93
+ Based on user's declared stack, create specialized agents using **best practices and common patterns** for that technology.
94
+
95
+ **Key difference from existing projects:**
96
+ - EXISTING: Sample real code → extract actual patterns
97
+ - NEW: Use framework best practices → will be refined later
98
+
99
+ **Agent Generation Guidelines:**
100
+
101
+ a. **Use official framework patterns**:
102
+ - Next.js → App Router, Server Components, Route Handlers
103
+ - Django → Class-based views, ORM, Django REST Framework
104
+ - Express → Middleware, async/await, error handling
105
+ - Spring Boot → Annotations, Dependency Injection, JPA
106
+
107
+ b. **Include canonical examples** (not placeholder code):
108
+ ```markdown
109
+ ## Example from Next.js documentation
110
+
111
+ ```typescript
112
+ // app/api/users/route.ts
113
+ import { NextResponse } from 'next/server';
114
+
115
+ export async function GET() {
116
+ const users = await db.user.findMany();
117
+ return NextResponse.json(users);
118
+ }
119
+ ```
120
+
121
+ Use this pattern when creating API routes.
122
+ ```
123
+
124
+ c. **Reference official documentation**:
125
+ - "See: https://nextjs.org/docs/app/building-your-application/routing/route-handlers"
126
+ - "Pattern based on Django documentation best practices"
127
+
128
+ d. **Mark as template-based**:
129
+ ```markdown
130
+ ---
131
+ name: nextjs-specialist
132
+ description: Handles Next.js implementation using best practices (will be updated with project patterns)
133
+ template: true
134
+ confidence: 0.4
135
+ ---
136
+
137
+ # Next.js Specialist (Template)
138
+
139
+ ⚠️ **This agent was generated from framework best practices.**
140
+ It will be updated with YOUR project's specific patterns after the first feature is implemented.
141
+
142
+ ## Best Practice Patterns
143
+
144
+ Based on Next.js 14 documentation and common conventions:
145
+ ...
146
+ ```
147
+
148
+ e. **Common stack combinations**:
149
+
150
+ **Next.js + Prisma:**
151
+ - `nextjs-specialist.md` - App Router, Server Components, API routes
152
+ - `prisma-specialist.md` - Schema design, migrations, queries
153
+
154
+ **Django + PostgreSQL:**
155
+ - `django-specialist.md` - Views, models, URL routing
156
+ - `postgres-specialist.md` - Schema design, indexing, queries
157
+
158
+ **Express + MongoDB:**
159
+ - `express-specialist.md` - Routes, middleware, async patterns
160
+ - `mongodb-specialist.md` - Collections, queries, aggregations
161
+
162
+ **Spring Boot + MySQL:**
163
+ - `spring-specialist.md` - Controllers, services, repositories
164
+ - `jpa-specialist.md` - Entities, relationships, JPQL
165
+
166
+ f. **Always generate these core agents** (framework-agnostic):
167
+ - Use existing `backend.md` and `frontend.md` as fallbacks
168
+ - Don't duplicate - only create specialized agents when needed
169
+
170
+ 5. **Mark for re-analysis**:
171
+ Set flag in architecture.json:
172
+ ```json
173
+ {
174
+ "project_type": "new",
175
+ "declared_stack": { /* user's choices */ },
176
+ "needs_reanalysis_after_first_code": true,
177
+ "confidence": 0.4
178
+ }
179
+ ```
180
+
181
+ **For EXISTING Projects** (has code to analyze):
20
182
 
21
- **For EXISTING projects**:
22
183
  1. Sample 3-5 files from `src/` or equivalent (or `app/`, `lib/`, `Controllers/`, etc.)
23
184
  2. Identify the patterns:
24
185
  - **Language**: Python? C#? JavaScript? Go? Rust? Java?
@@ -494,10 +655,82 @@ When you create an agent, ALWAYS include:
494
655
 
495
656
  Create/update `.agentful/architecture.json`:
496
657
 
658
+ **For NEW projects (declarative stack):**
659
+ ```json
660
+ {
661
+ "analysis_date": "2026-01-18T00:00:00Z",
662
+ "project_type": "new",
663
+ "analysis_source": "declared",
664
+ "declared_stack": {
665
+ "frontend": "Next.js 14",
666
+ "backend": "Node.js",
667
+ "database": "PostgreSQL",
668
+ "orm": "Prisma",
669
+ "testing": "Vitest",
670
+ "styling": "Tailwind CSS"
671
+ },
672
+ "detected_patterns": {
673
+ "framework": "Next.js 14 (App Router)",
674
+ "language": "TypeScript",
675
+ "primary_language": "TypeScript",
676
+ "structure": "to-be-determined",
677
+ "build_system": "npm",
678
+ "package_manager": "npm"
679
+ },
680
+ "tech_stack": {
681
+ "language": "TypeScript",
682
+ "primaryLanguage": "TypeScript",
683
+ "languages": ["TypeScript"],
684
+ "frameworks": ["Next.js", "React"],
685
+ "databases": ["PostgreSQL"],
686
+ "testingFrameworks": ["Vitest"],
687
+ "styling": ["Tailwind CSS"],
688
+ "buildSystem": "npm",
689
+ "packageManager": "npm",
690
+ "dependencies": [],
691
+ "devDependencies": [],
692
+ "confidence": 0.4
693
+ },
694
+ "domains": [],
695
+ "patterns": {
696
+ "imports": [],
697
+ "exports": [],
698
+ "styling": [],
699
+ "stateManagement": [],
700
+ "apiPatterns": [],
701
+ "testingFrameworks": []
702
+ },
703
+ "conventions": {
704
+ "naming": {},
705
+ "fileOrganization": "to-be-determined",
706
+ "importStyle": [],
707
+ "codeStyle": []
708
+ },
709
+ "generated_agents": [
710
+ "nextjs-specialist",
711
+ "prisma-specialist"
712
+ ],
713
+ "key_conventions_discovered": [],
714
+ "needs_reanalysis_after_first_code": true,
715
+ "confidence": 0.4,
716
+ "warnings": [
717
+ "Project has no code yet - using declared tech stack",
718
+ "Agents generated from best practices, not project patterns",
719
+ "Will re-analyze after first code is written"
720
+ ],
721
+ "recommendations": [
722
+ "Implement first feature to establish code patterns",
723
+ "Re-run architect after initial implementation"
724
+ ]
725
+ }
726
+ ```
727
+
728
+ **For EXISTING projects (detected patterns):**
497
729
  ```json
498
730
  {
499
731
  "analysis_date": "2026-01-18T00:00:00Z",
500
732
  "project_type": "existing",
733
+ "analysis_source": "detected",
501
734
  "detected_patterns": {
502
735
  "framework": "Next.js 14 (App Router)",
503
736
  "language": "TypeScript",
@@ -511,6 +744,20 @@ Create/update `.agentful/architecture.json`:
511
744
  "authentication": "NextAuth.js v5",
512
745
  "testing": "Vitest + React Testing Library + Playwright"
513
746
  },
747
+ "tech_stack": {
748
+ "language": "TypeScript",
749
+ "primaryLanguage": "TypeScript",
750
+ "languages": ["TypeScript", "JavaScript"],
751
+ "frameworks": ["Next.js", "React"],
752
+ "databases": ["PostgreSQL"],
753
+ "testingFrameworks": ["Vitest", "Playwright"],
754
+ "styling": ["Tailwind CSS"],
755
+ "buildSystem": "npm",
756
+ "packageManager": "npm",
757
+ "dependencies": ["next", "react", "prisma", "zustand"],
758
+ "devDependencies": ["vitest", "playwright"],
759
+ "confidence": 0.9
760
+ },
514
761
  "generated_agents": [
515
762
  "nextjs-specialist",
516
763
  "prisma-specialist",
@@ -526,16 +773,72 @@ Create/update `.agentful/architecture.json`:
526
773
  "Error responses use NextResponse.json()",
527
774
  "Database queries use Prisma Client",
528
775
  "Auth session checks on server components"
529
- ]
776
+ ],
777
+ "needs_reanalysis_after_first_code": false,
778
+ "confidence": 0.9
530
779
  }
531
780
  ```
532
781
 
533
782
  ## When to Run
534
783
 
535
784
  You are invoked by the orchestrator when:
536
- 1. agentful is first initialized on an existing project
537
- 2. product/index.md tech stack changes significantly
538
- 3. Orchestrator notices patterns don't match current agents
785
+
786
+ 1. **Initial setup** - agentful is first initialized (new or existing project)
787
+ 2. **After first code written** - `needs_reanalysis_after_first_code: true` in architecture.json
788
+ 3. **Tech stack changes** - product/index.md tech stack declaration changes significantly
789
+ 4. **Pattern drift detected** - Orchestrator notices existing code doesn't match current agents
790
+ 5. **Manual request** - User explicitly asks to re-analyze or regenerate agents
791
+ 6. **Low confidence warning** - confidence < 0.5 and code exists to analyze
792
+
793
+ ## Re-Analysis Workflow
794
+
795
+ When `needs_reanalysis_after_first_code: true`:
796
+
797
+ 1. **Triggered by orchestrator** after first feature completes:
798
+ ```
799
+ architecture.json shows:
800
+ - needs_reanalysis_after_first_code: true
801
+ - Some code now exists (wasn't there initially)
802
+
803
+ → Orchestrator delegates: Task("architect", "Re-analyze project now that code exists")
804
+ ```
805
+
806
+ 2. **You run full analysis** on actual code:
807
+ - Glob for source files (should find some now)
808
+ - Sample and analyze actual patterns
809
+ - Compare with declared stack (did they actually use what they said?)
810
+ - Update agents with real examples from the codebase
811
+ - Increase confidence score (0.4 → 0.8+)
812
+
813
+ 3. **Update architecture.json**:
814
+ ```json
815
+ {
816
+ "project_type": "existing",
817
+ "analysis_source": "detected",
818
+ "original_declared_stack": { /* what user said */ },
819
+ "detected_patterns": { /* what we found */ },
820
+ "needs_reanalysis_after_first_code": false,
821
+ "confidence": 0.85,
822
+ "notes": "Re-analyzed after initial implementation. Patterns match declared stack."
823
+ }
824
+ ```
825
+
826
+ 4. **Report findings**:
827
+ ```
828
+ ✅ Re-analysis complete!
829
+
830
+ Initial (declared): Next.js + PostgreSQL + Prisma
831
+ Actual (detected): Next.js 14 App Router + PostgreSQL + Prisma
832
+
833
+ Patterns discovered:
834
+ - Using Server Components by default
835
+ - API routes in src/app/api/
836
+ - Tailwind for styling
837
+ - TypeScript strict mode
838
+
839
+ Agents updated with real examples from your code.
840
+ Confidence: 40% → 85%
841
+ ```
539
842
 
540
843
  ## Integration
541
844
 
@@ -729,6 +729,105 @@ Update `.agentful/completion.json` after validated work.
729
729
  }
730
730
  ```
731
731
 
732
+ ## Architecture Re-Analysis
733
+
734
+ After updating `completion.json`, **ALWAYS check** if architecture needs re-analysis:
735
+
736
+ ### Check Architecture State
737
+
738
+ ```bash
739
+ Read(".agentful/architecture.json")
740
+
741
+ # Check for re-analysis flag
742
+ if architecture.needs_reanalysis_after_first_code == true:
743
+ # Check if any code has been written since initial analysis
744
+ source_files = Glob("src/**/*.{ts,tsx,js,jsx,py,go,rs,java,cs,rb,php,ex}")
745
+ excluding: node_modules, .git, dist, build
746
+
747
+ if source_files.count >= 3:
748
+ # Trigger re-analysis
749
+ trigger_reanalysis = true
750
+ ```
751
+
752
+ ### When to Trigger Re-Analysis
753
+
754
+ Invoke architect agent when:
755
+
756
+ 1. **First code written in new project**:
757
+ ```json
758
+ {
759
+ "needs_reanalysis_after_first_code": true,
760
+ "confidence": 0.4,
761
+ "project_type": "new"
762
+ }
763
+ ```
764
+ AND source files now exist (wasn't true initially)
765
+
766
+ 2. **Low confidence with existing code**:
767
+ ```json
768
+ {
769
+ "confidence": < 0.5,
770
+ "project_type": "existing"
771
+ }
772
+ ```
773
+ AND source files exist to analyze
774
+
775
+ 3. **Manual trigger**:
776
+ User explicitly asks to "re-analyze" or "regenerate agents"
777
+
778
+ ### Re-Analysis Workflow
779
+
780
+ ```bash
781
+ # After first feature completes in new project
782
+ if architecture.needs_reanalysis_after_first_code == true:
783
+ "🔄 Re-analyzing project architecture..."
784
+ "Initial analysis was based on declared tech stack."
785
+ "Now analyzing actual code patterns..."
786
+
787
+ Task("architect", "Re-analyze project now that code exists. Update agents with real patterns discovered in the codebase.")
788
+
789
+ # Architect will:
790
+ # 1. Sample actual source files
791
+ # 2. Detect patterns (how components written, how DB accessed, etc.)
792
+ # 3. Update specialized agents with REAL examples
793
+ # 4. Set needs_reanalysis_after_first_code = false
794
+ # 5. Increase confidence score (0.4 → 0.8+)
795
+
796
+ "✅ Architecture re-analyzed. Agents updated with your project's patterns."
797
+ ```
798
+
799
+ ### Example Scenario
800
+
801
+ ```
802
+ New Project Flow:
803
+
804
+ 1. User runs: npx @itz4blitz/agentful init
805
+ 2. Architect asks: "What tech stack?" → User: "Next.js + Prisma"
806
+ 3. Architect generates agents from best practices (confidence: 0.4)
807
+ 4. Sets: needs_reanalysis_after_first_code = true
808
+
809
+ 5. User runs: /agentful-start
810
+ 6. Orchestrator picks first feature: "authentication/login"
811
+ 7. Delegates to @nextjs-specialist (using template patterns)
812
+ 8. Code is written, validated, committed
813
+ 9. Updates completion.json: authentication/login = 100%
814
+
815
+ 10. ⚡ TRIGGER: Check architecture.json
816
+ 11. Sees: needs_reanalysis_after_first_code = true
817
+ 12. Sees: Source files now exist (src/app/, src/components/)
818
+ 13. Delegates: Task("architect", "Re-analyze...")
819
+ 14. Architect samples REAL code, updates agents with actual patterns
820
+ 15. Sets: needs_reanalysis_after_first_code = false, confidence = 0.85
821
+
822
+ 16. Continue with next feature using IMPROVED agents
823
+ ```
824
+
825
+ **Benefits:**
826
+ - Start fast with declared stack (no blocking on empty project)
827
+ - Learn real patterns after first implementation
828
+ - Continuously improve agent quality
829
+ - Higher confidence for remaining features
830
+
732
831
  ## Work Selection Priority
733
832
 
734
833
  When selecting next work, use this order:
package/README.md CHANGED
@@ -38,6 +38,51 @@ claude # Start Claude Code
38
38
 
39
39
  Then use the `/agentful-start` command to begin autonomous development.
40
40
 
41
+ #### New Projects (No Existing Code)
42
+
43
+ For brand new projects with no code yet:
44
+
45
+ 1. **Tech Stack Selection**: On first run, the architect agent will ask about your tech stack:
46
+ - Frontend framework (React, Vue, Next.js, etc.)
47
+ - Backend framework (Express, Django, Spring Boot, etc.)
48
+ - Database (PostgreSQL, MongoDB, MySQL, etc.)
49
+ - Additional tools (ORM, testing framework, styling)
50
+
51
+ 2. **Initial Agent Generation**: Specialized agents are generated using **best practices** for your chosen stack:
52
+ - Based on official framework documentation
53
+ - Using common patterns and conventions
54
+ - Marked with `confidence: 0.4` (template-based)
55
+
56
+ 3. **First Feature Implementation**: The system builds your first feature using these template agents
57
+
58
+ 4. **Automatic Re-Analysis**: After the first feature is complete:
59
+ - Architect re-analyzes your **actual code**
60
+ - Updates agents with **your project's specific patterns**
61
+ - Confidence increases (`0.4 → 0.8+`)
62
+ - Remaining features use refined, project-specific agents
63
+
64
+ **Benefits**:
65
+ - ✅ Start immediately without existing code
66
+ - ✅ No blocking on pattern detection
67
+ - ✅ Learns and adapts after first implementation
68
+ - ✅ Continuously improving agent quality
69
+
70
+ #### Existing Projects (With Code)
71
+
72
+ For projects with existing code:
73
+
74
+ 1. **Pattern Detection**: Architect samples your codebase to detect:
75
+ - Language and framework
76
+ - File organization patterns
77
+ - Coding conventions
78
+ - Import/export styles
79
+ - Error handling patterns
80
+
81
+ 2. **Agent Generation**: Creates specialized agents matching **your exact conventions**
82
+ - Real code examples from your project
83
+ - Your specific patterns and styles
84
+ - High confidence (`0.8-1.0`)
85
+
41
86
  ### 3. Monitor Progress
42
87
 
43
88
  - `/agentful-status` - View completion percentage and current work
@@ -53,7 +98,7 @@ agentful uses seven specialized agents:
53
98
  | Agent | Responsibility |
54
99
  |-------|---------------|
55
100
  | orchestrator | Coordinates work, routes tasks, tracks state |
56
- | architect | Analyzes project structure and generates specialized agents |
101
+ | architect | Analyzes project structure and generates specialized agents<br/>• New projects: Prompts for tech stack, generates template agents<br/>• Existing projects: Detects patterns from code<br/>• Re-analyzes after first implementation in new projects |
57
102
  | backend | Implements server-side logic, APIs, database schemas |
58
103
  | frontend | Implements UI components, pages, state management |
59
104
  | tester | Writes unit, integration, and end-to-end tests |
@@ -78,7 +123,10 @@ Runtime state is stored in `.agentful/`:
78
123
  - `state.json` - Current task and phase
79
124
  - `completion.json` - Feature completion status
80
125
  - `decisions.json` - Pending and resolved decisions
81
- - `architecture.json` - Detected technology stack
126
+ - `architecture.json` - Technology stack (declared or detected)
127
+ - New projects: Starts with declared stack (`confidence: 0.4`)
128
+ - Existing projects: Detected from code (`confidence: 0.8-1.0`)
129
+ - Re-analyzed after first implementation in new projects
82
130
 
83
131
  ## Commands
84
132
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@itz4blitz/agentful",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Autonomous product development kit for Claude Code with smart product analysis and natural conversation",
5
5
  "type": "module",
6
6
  "bin": {
7
- "agentful": "./bin/cli.js"
7
+ "agentful": "bin/cli.js"
8
8
  },
9
9
  "scripts": {
10
10
  "init": "node bin/cli.js init",
@@ -33,7 +33,7 @@
33
33
  "license": "MIT",
34
34
  "repository": {
35
35
  "type": "git",
36
- "url": "https://github.com/itz4blitz/agentful"
36
+ "url": "git+https://github.com/itz4blitz/agentful.git"
37
37
  },
38
38
  "homepage": "https://agentful.app",
39
39
  "engines": {
package/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.1.8"
2
+ "version": "0.1.9"
3
3
  }