@christianmaf80/agentic-workflow 1.2.0-beta.1

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 (67) hide show
  1. package/LICENSE +15 -0
  2. package/README.es.md +88 -0
  3. package/README.md +88 -0
  4. package/bin/cli.js +44 -0
  5. package/dist/artifacts/index.md +28 -0
  6. package/dist/cli/commands/create.js +178 -0
  7. package/dist/cli/commands/init.js +212 -0
  8. package/dist/cli/commands/mcp-register.js +33 -0
  9. package/dist/cli/commands/restore.js +67 -0
  10. package/dist/cli/index.js +2 -0
  11. package/dist/core/context/manager.js +136 -0
  12. package/dist/core/index.js +1 -0
  13. package/dist/core/mapping/resolver.js +72 -0
  14. package/dist/core/migration/backup.js +14 -0
  15. package/dist/core/migration/detector.js +32 -0
  16. package/dist/core/migration/transformer.js +11 -0
  17. package/dist/core/utils/backup.js +41 -0
  18. package/dist/mcp/server.js +160 -0
  19. package/dist/rules/constitution/GEMINI.location.md +29 -0
  20. package/dist/rules/constitution/agent-system.md +77 -0
  21. package/dist/rules/constitution/agents-behavior.md +188 -0
  22. package/dist/rules/constitution/clean-code.md +153 -0
  23. package/dist/rules/constitution/index.md +29 -0
  24. package/dist/rules/constitution/project-architecture.md +57 -0
  25. package/dist/rules/index.md +26 -0
  26. package/dist/rules/roles/architect.md +40 -0
  27. package/dist/rules/roles/index.md +45 -0
  28. package/dist/rules/roles/neo.md +32 -0
  29. package/dist/rules/roles/qa.md +22 -0
  30. package/dist/rules/roles/researcher.md +22 -0
  31. package/dist/rules/roles/tooling.md +22 -0
  32. package/dist/templates/acceptance.md +64 -0
  33. package/dist/templates/agent-scores.md +25 -0
  34. package/dist/templates/agent-task.md +106 -0
  35. package/dist/templates/analysis.md +161 -0
  36. package/dist/templates/brief.md +96 -0
  37. package/dist/templates/changelog.md +30 -0
  38. package/dist/templates/closure.md +87 -0
  39. package/dist/templates/index.md +45 -0
  40. package/dist/templates/init.md +26 -0
  41. package/dist/templates/planning.md +157 -0
  42. package/dist/templates/research.md +89 -0
  43. package/dist/templates/results-acceptance.md +177 -0
  44. package/dist/templates/review.md +110 -0
  45. package/dist/templates/subtask-implementation.md +67 -0
  46. package/dist/templates/supplemental-report.md +30 -0
  47. package/dist/templates/task-metrics.md +39 -0
  48. package/dist/templates/task.md +151 -0
  49. package/dist/templates/todo-item.md +49 -0
  50. package/dist/templates/verification.md +77 -0
  51. package/dist/workflows/index.md +44 -0
  52. package/dist/workflows/init.md +61 -0
  53. package/dist/workflows/tasklifecycle-long/index.md +176 -0
  54. package/dist/workflows/tasklifecycle-long/phase-0-acceptance-criteria.md +161 -0
  55. package/dist/workflows/tasklifecycle-long/phase-1-research.md +151 -0
  56. package/dist/workflows/tasklifecycle-long/phase-2-analysis.md +136 -0
  57. package/dist/workflows/tasklifecycle-long/phase-3-planning.md +121 -0
  58. package/dist/workflows/tasklifecycle-long/phase-4-implementation.md +104 -0
  59. package/dist/workflows/tasklifecycle-long/phase-5-verification.md +82 -0
  60. package/dist/workflows/tasklifecycle-long/phase-6-results-acceptance.md +79 -0
  61. package/dist/workflows/tasklifecycle-long/phase-7-evaluation.md +85 -0
  62. package/dist/workflows/tasklifecycle-long/phase-8-commit-push.md +80 -0
  63. package/dist/workflows/tasklifecycle-short/index.md +67 -0
  64. package/dist/workflows/tasklifecycle-short/short-phase-1-brief.md +66 -0
  65. package/dist/workflows/tasklifecycle-short/short-phase-2-implementation.md +72 -0
  66. package/dist/workflows/tasklifecycle-short/short-phase-3-closure.md +67 -0
  67. package/package.json +53 -0
@@ -0,0 +1,161 @@
1
+ ---
2
+ id: workflow.tasklifecycle.phase-0-acceptance-criteria
3
+ description: Converts the task candidate into a final task. The architect defines acceptance criteria through 5 mandatory questions based on the task and its objective, and creates the current task needed to start the lifecycle.
4
+ owner: architect-agent
5
+ version: 1.3.0
6
+ severity: PERMANENT
7
+ trigger:
8
+ commands: ["phase0", "phase-0", "acceptance", "acceptance-criteria"]
9
+ blocking: true
10
+ ---
11
+
12
+ # WORKFLOW: tasklifecycle.phase-0-acceptance-criteria
13
+
14
+ ## Input (REQUIRED)
15
+ - Task candidate created by `workflow.tasklifecycle-long`:
16
+ - `artifacts.candidate.task`
17
+ - The candidate `task.md` **MUST** include:
18
+ - Task description
19
+ - Task objective
20
+
21
+ > [!IMPORTANT]
22
+ > **Active Constitution (MANDATORY)**:
23
+ > - Load `constitution.project_architecture` before starting
24
+ > - Load `constitution.agents_behavior` (Section 7: Gates, Section 8: Constitution)
25
+
26
+ ## Output (REQUIRED)
27
+ - Current task (final) with complete acceptance criteria:
28
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md`
29
+
30
+ ## Template (MANDATORY)
31
+ - The current task **MUST** be created using the template:
32
+ - `templates.task`
33
+ - If the template doesn't exist or cannot be loaded → **FAIL**.
34
+
35
+ ## Objective (ONLY)
36
+ - Move from **task candidate** to **current task** (final).
37
+ - **Calculate the final `taskId`**.
38
+ - Define **mandatory** acceptance criteria based on 5 clarifying questions to the developer.
39
+ - Record acceptance criteria within the current task file.
40
+
41
+ ## Reasoning (MANDATORY)
42
+ - Before executing, the responsible agent must explain to the developer what will be done and why.
43
+ - No document is required for this step.
44
+
45
+ ## Mandatory Steps
46
+ 0. **Role Activation and Prefix (MANDATORY)**
47
+ - The `architect-agent` **MUST** begin its intervention by identifying itself.
48
+ - Message: `🏛️ **architect-agent**: Starting Phase 0 - Acceptance Criteria.`
49
+
50
+ 1. Load and read task candidate:
51
+ - `artifacts.candidate.task`
52
+ - Extract:
53
+ - Task description
54
+ - Task objective
55
+ - If missing → go to **Step 10 (FAIL)**.
56
+
57
+ 2. Load task contractual template:
58
+ - Load `templates.task`
59
+ - If it doesn't exist or cannot be loaded → go to **Step 10 (FAIL)**.
60
+
61
+ 3. **Calculate `taskId` (MANDATORY – Architect)**
62
+ - The `architect-agent` **MUST** execute the following command:
63
+ ```bash
64
+ ls .agent/artifacts/ | grep -E "^[0-9]" | sort -n | tail -1 | cut -d'-' -f1
65
+ ```
66
+ - The output shows the last taskId (e.g., "8").
67
+ - New `taskId = output + 1` (e.g., if output is "8", new taskId is "9").
68
+ - If no output (no previous tasks) → `taskId = 1`.
69
+ - The final value of `taskId` is **mandatory** to continue.
70
+
71
+ 4. Define `taskTitle` (Architect)
72
+ - Derive `taskTitle` from the developer's request (candidate).
73
+ - Normalize for filesystem:
74
+ - Lowercase
75
+ - Spaces → `-`
76
+ - No special characters
77
+
78
+ 5. Formulate clarifying questions (MANDATORY, task-adaptive)
79
+ - The `architect-agent` **MUST** analyze:
80
+ - `task.description`
81
+ - `task.goal`
82
+ - Based on that analysis, it **MUST formulate exactly 5 questions** aimed at:
83
+ - Eliminating ambiguities
84
+ - Completing missing information
85
+ - Allowing the definition of verifiable acceptance criteria
86
+ - The questions:
87
+ - **MUST NOT** duplicate information already explicit
88
+ - **MUST** be directly related to the specific task
89
+ - **MAY** vary according to task context
90
+
91
+ 6. Validate responses and close definition (MANDATORY)
92
+ - Confirm that the 5 formulated questions have explicit answers.
93
+ - Based on the answers, the `architect-agent` **MUST**:
94
+ - Consolidate a complete definition of the task
95
+ - Derive verifiable acceptance criteria
96
+ - If any answer is missing or ambiguity persists → go to **Step 10 (FAIL)**.
97
+
98
+ 7. Create current task (MANDATORY)
99
+ - Create the task directory (if missing):
100
+ - `.agent/artifacts/<taskId>-<taskTitle>/`
101
+ - Create status file:
102
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md` (using `templates.task`)
103
+ - Create acceptance file:
104
+ - `.agent/artifacts/<taskId>-<taskTitle>/acceptance.md` (using `templates.acceptance`)
105
+ - The `task.md` **will only contain**:
106
+ - Metadata (id, title, owner, strategy)
107
+ - Phase history
108
+ - `task.acceptance` alias pointing to the new file
109
+ - The `acceptance.md` **will contain**:
110
+ - Consolidated definition
111
+ - Detailed 5 answers
112
+ - Checklist of verifiable criteria (AC)
113
+ - If creation/writing fails → go to **Step 10 (FAIL)**.
114
+
115
+ 8. Request developer approval (MANDATORY, via console)
116
+ - The developer **MUST** explicitly approve:
117
+ - Acceptance criteria
118
+ - Created current task
119
+ - Record the decision in `acceptance.md`:
120
+ ```yaml
121
+ approval:
122
+ developer:
123
+ decision: YES | NO
124
+ date: <ISO-8601>
125
+ comments: <optional>
126
+ ```
127
+ - If `decision != YES` → go to **Step 10 (FAIL)**.
128
+
129
+ 9. PASS
130
+ - Inform that Phase 0 is completed successfully.
131
+ - The `architect-agent` **MUST explicitly perform** the following actions (using prefix):
132
+ - Mark Phase 0 as completed in `task.md`.
133
+ - Set `task.lifecycle.phases.phase-0-acceptance-criteria.validated_at = <ISO-8601>`.
134
+ - Update `task.phase.updated_at = <ISO-8601>`.
135
+ - Update status:
136
+ - `task.phase.current = aliases.taskcycle-long.phases.phase_1.id`
137
+
138
+ 10. FAIL (mandatory)
139
+ - Declare Phase 0 as **NOT completed**.
140
+ - Specify exactly what failed.
141
+ - End blocked: do not advance the phase.
142
+
143
+ ## Pass
144
+ - All required artifacts are created from templates.
145
+ - Developer approval is recorded where required.
146
+
147
+ ## Gate (REQUIRED)
148
+ Requirements (all mandatory):
149
+ 1. `.agent/artifacts/<taskId>-<taskTitle>/task.md` and `acceptance.md` exist.
150
+ 2. The current task includes complete and verifiable acceptance criteria.
151
+ 3. Explicit developer approval is recorded in `acceptance.md`:
152
+ - `approval.developer.decision == YES`
153
+ 4. The `architect-agent` has explicitly marked:
154
+ - Phase 0 as completed
155
+ - `task.lifecycle.phases.phase-0-acceptance-criteria.completed == true`
156
+ - `task.lifecycle.phases.phase-0-acceptance-criteria.validated_at` not null
157
+ - `task.phase.updated_at` not null
158
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_1.id`
159
+
160
+ If Gate FAIL:
161
+ - Execute **FAIL**.
@@ -0,0 +1,151 @@
1
+ ---
2
+ id: workflow.tasklifecycle.phase-1-research
3
+ description: Task cycle Phase 1. Exhaustive technical research of needs and alternatives. Requires explicit developer approval.
4
+ owner: researcher-agent
5
+ version: 1.1.0
6
+ severity: PERMANENT
7
+ trigger:
8
+ commands: ["phase1", "phase-1", "research"]
9
+ blocking: true
10
+ ---
11
+
12
+ # WORKFLOW: tasklifecycle.phase-1-research
13
+
14
+ ## Input (REQUIRED)
15
+ - Current task exists:
16
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md`
17
+ - `task.md` **MUST** reflect:
18
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_1.id`
19
+ - `task.md` **MUST** include:
20
+ - Description
21
+ - Objective
22
+ - Defined acceptance criteria
23
+
24
+ > [!IMPORTANT]
25
+ > **Active Constitution (MANDATORY)**:
26
+ > - Load `constitution.project_architecture` before starting
27
+ > - Load `constitution.agents_behavior` (Section 7: Gates, Section 8: Constitution)
28
+
29
+ ## Output (REQUIRED)
30
+ - Research report (mandatory, generated by researcher-agent):
31
+ - `.agent/artifacts/<taskId>-<taskTitle>/researcher/research.md`
32
+ - Status update in current task:
33
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md`
34
+
35
+ ## Objective (ONLY)
36
+ - Investigate technical needs detected for the task.
37
+ - Explore relevant alternatives and APIs.
38
+ - Document multi-browser compatibility and risks.
39
+ - Deliver a rigorous and verifiable report to the architect-agent.
40
+
41
+ > This phase **DOES NOT implement code**.
42
+ > This phase **REQUIRES explicit developer approval**.
43
+
44
+ > [!CAUTION]
45
+ > **PERMANENT RULE**: Research DOCUMENTS, it DOES NOT analyze.
46
+ > The researcher-agent gathers information from official sources.
47
+ > **FORBIDDEN**: Proposing solutions, evaluating trade-offs, recommending alternatives.
48
+ > Analysis belongs to Phase 2.
49
+
50
+ ## Template (MANDATORY)
51
+ - The report **MUST** be created using the template:
52
+ - `templates.research`
53
+ - If the template doesn't exist or cannot be loaded → **FAIL**.
54
+
55
+ ---
56
+
57
+ ## Reasoning (MANDATORY)
58
+ - Before executing, the responsible agent must explain to the developer what will be done and why.
59
+ - No document is required for this step.
60
+
61
+ ## Mandatory Steps
62
+
63
+ 0. **Role Activation and Prefix (MANDATORY)**
64
+ - The `architect-agent` **MUST** begin its intervention by identifying itself.
65
+ - Message: `🏛️ **architect-agent**: Starting Phase 1 - Research.`
66
+
67
+ 1. Verify inputs (architect-agent)
68
+ - `task.md` exists
69
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_1.id`
70
+ - `task.md` contains acceptance criteria
71
+ - If fails → go to **Step 8 (FAIL)**.
72
+
73
+ 2. Load research template (architect-agent)
74
+ - Load `templates.research`
75
+ - If it doesn't exist or cannot be read → go to **Step 8 (FAIL)**.
76
+
77
+ 3. **Delegate to researcher-agent (MANDATORY)**
78
+ > ⚠️ **PERMANENT RULE**: The `architect-agent` **CANNOT** create the research report.
79
+ > The `researcher-agent` is the **only authorized agent** to create `research.md`.
80
+
81
+ The `architect-agent` **MUST**:
82
+ a) Activate the `researcher-agent` with the task context:
83
+ - Task description and objective
84
+ - Acceptance criteria
85
+ - Template to use (`templates.research`)
86
+ b) The `researcher-agent` **MUST** identify itself: `🔬 **researcher-agent**: Starting technical research for <taskName>...`
87
+ c) Wait for the `researcher-agent` to complete its report
88
+ d) Verify that the report exists and complies with the template
89
+
90
+ The `researcher-agent` **MUST**:
91
+ - Create directory: `.agent/artifacts/<taskId>-<taskTitle>/researcher/`
92
+ - Create report: `.agent/artifacts/<taskId>-<taskTitle>/researcher/research.md` (using `templates.research`)
93
+ - Cover all mandatory points:
94
+ - Technical alternatives and relevant APIs
95
+ - Multi-browser compatibility
96
+ - Risks and trade-offs
97
+ - AI-first recommendations
98
+ - Official or prestigious sources
99
+ - Hand back control to the `architect-agent` upon completion
100
+
101
+ 4. Request developer approval (MANDATORY, via console)
102
+ - The developer **MUST** issue a binary decision:
103
+ - **YES** → Approved
104
+ - **NO** → Rejected
105
+ - Record the decision in `research.md` with format:
106
+ ```yaml
107
+ approval:
108
+ developer:
109
+ decision: YES | NO
110
+ date: <ISO-8601>
111
+ comments: <optional>
112
+ ```
113
+ - If `decision != YES` → go to **Step 8 (FAIL)**.
114
+
115
+ 5. PASS
116
+ - Update `.agent/artifacts/<taskId>-<taskTitle>/task.md` (using prefix):
117
+ - Mark Phase 1 as completed
118
+ - Set `task.lifecycle.phases.phase-1-research.validated_at = <ISO-8601>`
119
+ - Update `task.phase.updated_at = <ISO-8601>`
120
+ - Advance `task.phase.current = aliases.taskcycle-long.phases.phase_2.id`
121
+
122
+ ---
123
+
124
+ ## FAIL (MANDATORY)
125
+
126
+ 8. Declare Phase 1 as **NOT completed**.
127
+ - Specify exactly what failed.
128
+ - End blocked: do not advance phase.
129
+
130
+ ---
131
+
132
+ ## Pass
133
+ - All required artifacts are created from templates.
134
+ - Developer approval is recorded where required.
135
+
136
+ ## Gate (REQUIRED)
137
+
138
+ Requirements (all mandatory):
139
+ 1. `.agent/artifacts/<taskId>-<taskTitle>/researcher/research.md` exists.
140
+ 2. The report follows the `templates.research` template structure.
141
+ 3. The report was created by the `researcher-agent`.
142
+ 4. Explicit developer approval is recorded in `research.md`:
143
+ - `approval.developer.decision == YES`
144
+ 5. `task.md` reflects timestamps and state:
145
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_2.id`
146
+ - `task.lifecycle.phases.phase-1-research.completed == true`
147
+ - `task.lifecycle.phases.phase-1-research.validated_at` not null
148
+ - `task.phase.updated_at` not null
149
+
150
+ If Gate FAIL:
151
+ - Execute **Step 8 (FAIL)**.
@@ -0,0 +1,136 @@
1
+ ---
2
+ id: workflow.tasklifecycle.phase-2-analysis
3
+ description: Task cycle Phase 2. Deep analysis based on previous research, covers acceptance criteria and defines agents, responsibilities, and impact. Requires developer approval.
4
+ owner: architect-agent
5
+ version: 1.1.0
6
+ severity: PERMANENT
7
+ trigger:
8
+ commands: ["phase2", "phase-2", "analysis"]
9
+ blocking: true
10
+ ---
11
+
12
+ # WORKFLOW: tasklifecycle.phase-2-analysis
13
+
14
+ ## Input (REQUIRED)
15
+ - Current task created in Phase 0 exists:
16
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md`
17
+ - Approved research report exists:
18
+ - `.agent/artifacts/<taskId>-<taskTitle>/researcher/research.md`
19
+ - `task.md` **MUST** include:
20
+ - Description
21
+ - Objective
22
+ - Defined acceptance criteria
23
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_2.id`
24
+
25
+ > [!IMPORTANT]
26
+ > **Active Constitution (MANDATORY)**:
27
+ > - Load `constitution.project_architecture` before starting
28
+ > - Load `constitution.agents_behavior` (Section 7: Gates, Section 8: Constitution)
29
+
30
+ ## Output (REQUIRED)
31
+ - Create analysis artifact **based on template**:
32
+ - `.agent/artifacts/<taskId>-<taskTitle>/analysis.md`
33
+ - Status update in current task:
34
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md`
35
+
36
+ ## Objective (ONLY)
37
+ Create a deep **analysis** report that:
38
+ - Covers **all** acceptance criteria from `task.md`
39
+ - Respects project architecture and rules
40
+ - Defines agents, sub-areas, and task impact
41
+ - Identifies if the task requires creating, modifying, or deleting system components
42
+ - Serves as **contractual input** for Phase 3 (Planning)
43
+
44
+ > This phase **DOES NOT implement code**.
45
+ > This phase **DOES NOT plan detailed execution**.
46
+ > This phase **REQUIRES explicit developer approval**.
47
+
48
+ ## Template (MANDATORY)
49
+ - The report **MUST** be created using the template:
50
+ - `templates.analysis`
51
+ - If the template doesn't exist or cannot be loaded → **FAIL**.
52
+
53
+ ## Reasoning (MANDATORY)
54
+ - Before executing, the responsible agent must explain to the developer what will be done and why.
55
+ - No document is required for this step.
56
+
57
+ ## Mandatory Steps
58
+ 0. **Role Activation and Prefix (MANDATORY)**
59
+ - The `architect-agent` **MUST** begin its intervention by identifying itself.
60
+ - Message: `🏛️ **architect-agent**: Starting Phase 2 - Analysis.`
61
+
62
+ 1. Verify inputs
63
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md` exists
64
+ - `.agent/artifacts/<taskId>-<taskTitle>/researcher/research.md` exists
65
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_2.id`
66
+ - Research is developer-approved (YES)
67
+ - If fails → go to **Step 10 (FAIL)**.
68
+
69
+ 2. Load analysis template
70
+ - Load `templates.analysis`
71
+ - If it doesn't exist or cannot be read → go to **Step 10 (FAIL)**.
72
+
73
+ 3. Create analysis instance
74
+ - Copy template to:
75
+ - `.agent/artifacts/<taskId>-<taskTitle>/analysis.md`
76
+ - Fill sections according to the specific task.
77
+
78
+ 4. Analyze project state
79
+ - Review structure, drivers, modules, and previous tasks if applicable.
80
+ - Document findings in `analysis.md`.
81
+
82
+ 5. Integrate approved research
83
+ - Base alternatives, risks, and compatibility on `research.md`.
84
+
85
+ 6. Acceptance criteria coverage
86
+ - Map **every acceptance criteria** to its analysis, verification, and risks.
87
+
88
+ 7. Define agents and sub-areas
89
+ - List required agents.
90
+ - Define responsibilities and handoffs.
91
+
92
+ 8. Request developer approval (MANDATORY, via console)
93
+ - The developer **MUST** issue a binary decision:
94
+ - **YES** (Approved)
95
+ - **NO** (Rejected)
96
+ - Record in `analysis.md`:
97
+ ```yaml
98
+ approval:
99
+ developer:
100
+ decision: YES | NO
101
+ date: <ISO-8601>
102
+ comments: <optional>
103
+ ```
104
+ - If `decision != YES` → go to **Step 10 (FAIL)**.
105
+
106
+ 9. PASS
107
+ - Update `.agent/artifacts/<taskId>-<taskTitle>/task.md` (using prefix):
108
+ - Mark Phase 2 as completed
109
+ - Set `task.lifecycle.phases.phase-2-analysis.validated_at = <ISO-8601>`
110
+ - Update `task.phase.updated_at = <ISO-8601>`
111
+ - Advance `task.phase.current = aliases.taskcycle-long.phases.phase_3.id`
112
+
113
+ ## FAIL (MANDATORY)
114
+ 10. Declare Phase 2 as **NOT completed**.
115
+ - Specify exactly what failed.
116
+ - End blocked: do not advance phase.
117
+
118
+ ## Pass
119
+ - All required artifacts are created from templates.
120
+ - Developer approval is recorded where required.
121
+
122
+ ## Gate (REQUIRED)
123
+ Requirements (all mandatory):
124
+ 1. `.agent/artifacts/<taskId>-<taskTitle>/analysis.md` exists.
125
+ 2. The file follows the `templates.analysis` template structure.
126
+ 3. Covers all acceptance criteria from `task.md`.
127
+ 4. Explicit developer approval is recorded in `analysis.md`:
128
+ - `approval.developer.decision == YES`
129
+ 5. `task.md` reflects timestamps and state:
130
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_3.id`
131
+ - `task.lifecycle.phases.phase-2-analysis.completed == true`
132
+ - `task.lifecycle.phases.phase-2-analysis.validated_at` not null
133
+ - `task.phase.updated_at` not null
134
+
135
+ If Gate FAIL:
136
+ - Execute **Step 10 (FAIL)**.
@@ -0,0 +1,121 @@
1
+ ---
2
+ id: workflow.tasklifecycle.phase-3-planning
3
+ description: Task cycle Phase 3. Defines the implementation plan based on previous analysis, assigns responsibilities per agent, details testing, demo, estimations, and critical points. Requires explicit developer approval.
4
+ owner: architect-agent
5
+ version: 1.1.0
6
+ severity: PERMANENT
7
+ trigger:
8
+ commands: ["phase3", "phase-3", "planning", "plan"]
9
+ blocking: true
10
+ ---
11
+
12
+ # WORKFLOW: tasklifecycle.phase-3-planning
13
+
14
+ ## Input (REQUIRED)
15
+ - Analysis artifact created in Phase 2 exists:
16
+ - `.agent/artifacts/<taskId>-<taskTitle>/analysis.md`
17
+ - Current task exists:
18
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md`
19
+ - `task.md` **MUST** reflect:
20
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_3.id`
21
+
22
+ > [!IMPORTANT]
23
+ > **Active Constitution (MANDATORY)**:
24
+ > - Load `constitution.project_architecture` before starting
25
+ > - Load `constitution.agents_behavior` (Section 7: Gates, Section 8: Constitution)
26
+
27
+ ## Output (REQUIRED)
28
+ - Create implementation plan:
29
+ - `.agent/artifacts/<taskId>-<taskTitle>/plan.md`
30
+ - Status update in current task:
31
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md`
32
+
33
+ ## Objective (ONLY)
34
+ Create a **detailed implementation plan** to execute the design defined in Phase 2, which:
35
+ - Translates analysis into executable steps
36
+ - Assigns clear responsibilities per agent and rule injection
37
+ - Defines how the task will be validated (tests and verifications)
38
+
39
+ > This phase **DOES NOT implement code**.
40
+ > This phase **REQUIRES explicit and strict developer approval (YES / NO)**.
41
+
42
+ ## Template (MANDATORY)
43
+ - The plan **MUST** be created using the template:
44
+ - `templates.planning`
45
+ - If the template doesn't exist or cannot be loaded → **FAIL**.
46
+
47
+ ---
48
+
49
+ ## Reasoning (MANDATORY)
50
+ - Before executing, the responsible agent must explain to the developer what will be done and why.
51
+ - No document is required for this step.
52
+
53
+ ## Mandatory Steps
54
+
55
+ 0. **Role Activation and Prefix (MANDATORY)**
56
+ - The `architect-agent` **MUST** begin its intervention by identifying itself.
57
+ - Message: `🏛️ **architect-agent**: Starting Phase 3 - Planning.`
58
+
59
+ 1. Verify inputs
60
+ - `.agent/artifacts/<taskId>-<taskTitle>/analysis.md` exists
61
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md` exists
62
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_3.id`
63
+ - If fails → go to **Step 11 (FAIL)**.
64
+
65
+ 2. Load planning template
66
+ - Load `templates.planning`
67
+ - If it doesn't exist or cannot be read → go to **Step 11 (FAIL)**.
68
+
69
+ 3. Create plan instance
70
+ - Copy template to:
71
+ - `.agent/artifacts/<taskId>-<taskTitle>/plan.md`
72
+ - Fill all sections using `analysis.md` as a contract.
73
+
74
+ 4. Decompress tasks
75
+ - Identify every necessary sub-task.
76
+ - Define responsible agent.
77
+
78
+ 5. Request developer approval (MANDATORY, via console)
79
+ - The developer **MUST** issue a binary decision:
80
+ - **YES** (Approved)
81
+ - **NO** (Rejected)
82
+ - Record the decision in `plan.md`:
83
+ ```yaml
84
+ approval:
85
+ developer:
86
+ decision: YES | NO
87
+ date: <ISO-8601>
88
+ comments: <optional>
89
+ ```
90
+ - If `decision != YES` → go to **Step 11 (FAIL)**.
91
+
92
+ 6. PASS
93
+ - Update `.agent/artifacts/<taskId>-<taskTitle>/task.md` (using prefix):
94
+ - Mark Phase 3 as completed
95
+ - Set `task.lifecycle.phases.phase-3-planning.validated_at = <ISO-8601>`
96
+ - Update `task.phase.updated_at = <ISO-8601>`
97
+ - Advance `task.phase.current = aliases.taskcycle-long.phases.phase_4.id`
98
+
99
+ ## FAIL (MANDATORY)
100
+ 10. Declare Phase 3 as **NOT completed**.
101
+ - Specify exactly what failed.
102
+ - End blocked: do not advance phase.
103
+
104
+ ## Pass
105
+ - All required artifacts are created from templates.
106
+ - Developer approval is recorded where required.
107
+
108
+ ## Gate (REQUIRED)
109
+ Requirements (all mandatory):
110
+ 1. `.agent/artifacts/<taskId>-<taskTitle>/plan.md` exists.
111
+ 2. The plan follows the `templates.planning` template structure.
112
+ 3. Explicit developer approval is recorded in `plan.md`:
113
+ - `approval.developer.decision == YES`
114
+ 4. `task.md` reflects timestamps and state:
115
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_4.id`
116
+ - `task.lifecycle.phases.phase-3-planning.completed == true`
117
+ - `task.lifecycle.phases.phase-3-planning.validated_at` not null
118
+ - `task.phase.updated_at` not null
119
+
120
+ If Gate FAIL:
121
+ - Execute **Step 10 (FAIL)**.
@@ -0,0 +1,104 @@
1
+ ---
2
+ id: workflow.tasklifecycle.phase-4-implementation
3
+ description: Task cycle Phase 4. Executes implementation through granular task delegation to agents with developer approval Gate for each task. Only proceeds if all tasks are approved.
4
+ owner: architect-agent
5
+ version: 3.1.0
6
+ severity: PERMANENT
7
+ trigger:
8
+ commands: ["phase4", "phase-4", "implementation", "implement"]
9
+ blocking: true
10
+ ---
11
+
12
+ # WORKFLOW: tasklifecycle.phase-4-implementation
13
+
14
+ ## Input (REQUIRED)
15
+ - Approved implementation plan exists:
16
+ - `.agent/artifacts/<taskId>-<taskTitle>/plan.md`
17
+ - Current task exists:
18
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md`
19
+ - `task.md` **MUST** reflect:
20
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_4.id`
21
+
22
+ > [!IMPORTANT]
23
+ > **Active Constitution (MANDATORY)**:
24
+ > - Load `constitution.project_architecture` before starting
25
+ > - Load `constitution.agents_behavior` (Section 7: Gates, Section 8: Constitution)
26
+
27
+ ## Output (REQUIRED)
28
+ - For **each agent task**:
29
+ - `.agent/artifacts/<taskId>-<taskTitle>/agent-tasks/<N>-<agent>-<taskName>.md`
30
+ - Architect review report:
31
+ - `.agent/artifacts/<taskId>-<taskTitle>/architect/review.md`
32
+ - Status update in:
33
+ - `.agent/artifacts/<taskId>-<taskTitle>/task.md`
34
+
35
+ ## Objective (ONLY)
36
+ - Execute **all implementation tasks** defined in the approved plan through **granular delegation**.
37
+ - Each task requires **explicit developer approval** (YES).
38
+
39
+ ---
40
+
41
+ ## Reasoning (MANDATORY)
42
+ - Before executing, the responsible agent must explain to the developer what will be done and why.
43
+ - No document is required for this step.
44
+
45
+ ## Mandatory Steps
46
+
47
+ 0. **Role Activation and Prefix (MANDATORY)**
48
+ - The `architect-agent` **MUST** begin its intervention by identifying itself.
49
+ - Message: `🏛️ **architect-agent**: Starting Phase 4 - Implementation.`
50
+
51
+ 1. Verify inputs
52
+ - Approved `plan.md` exists.
53
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_4.id`.
54
+
55
+ 2. Extract tasks from plan
56
+ - Read `plan.md`.
57
+ - Create directory: `.agent/artifacts/<taskId>-<taskTitle>/agent-tasks/`
58
+
59
+ 3. Delegation Loop (SYNCHRONOUS - AHRP Protocol)
60
+ For each task `N`:
61
+ 3.1 **Preparation**: Create task file using `templates.agent_task`. Initial status is `blocked`.
62
+ 3.2 **Assignment**: The `architect-agent` presents the task.
63
+ 3.3 **Gate A (Activation)**: The assigned agent must wait for the developer to sign with `decision: YES` in the activation block.
64
+ - **FORBIDDEN**: The agent cannot use tools until Gate A PASS.
65
+ 3.4 **Gate B (Reasoning)**: Once activated, the agent must present its `Reasoning`.
66
+ - The developer must sign the reasoning with `decision: YES`.
67
+ - **FORBIDDEN**: The agent cannot modify code until Gate B PASS.
68
+ 3.5 **Execution**: The agent develops the task following the approved plan.
69
+ 3.6 **Gate C (Results)**: The developer validates the final result with `decision: YES`.
70
+ 3.7 **Closure**: If all gates are PASS, mark as `completed` and update `task.md`.
71
+
72
+ 4. Implementation Consolidation
73
+ - Verify that all tasks have complied with the AHRP protocol (A, B, and C).
74
+
75
+ 5. Create Architectural Review Report (MANDATORY)
76
+ - Create: `.agent/artifacts/<taskId>-<taskTitle>/architect/review.md` (using `templates.review`).
77
+
78
+ 6. Final Developer Gate (MANDATORY, via console)
79
+ - Global confirmation with **YES**.
80
+ - Record in `architect/review.md`: `decision: YES`.
81
+
82
+ 7. PASS
83
+ - Update `.agent/artifacts/<taskId>-<taskTitle>/task.md` (using prefix):
84
+ - Mark Phase 4 as completed
85
+ - Set `task.lifecycle.phases.phase-4-implementation.validated_at = <ISO-8601>`
86
+ - Update `task.phase.updated_at = <ISO-8601>`
87
+ - Advance to Phase 5.
88
+
89
+ ## Pass
90
+ - All required artifacts are created from templates.
91
+ - Developer approval is recorded where required.
92
+
93
+ ## Gate (REQUIRED)
94
+ Requirements (all mandatory):
95
+ 1. All tasks have Gate PASS (`approval.developer.decision == YES`).
96
+ 2. `architect/review.md` exists with final Gate PASS (YES).
97
+ 3. `task.md` reflects timestamps and state:
98
+ - `task.phase.current == aliases.taskcycle-long.phases.phase_5.id`
99
+ - `task.lifecycle.phases.phase-4-implementation.completed == true`
100
+ - `task.lifecycle.phases.phase-4-implementation.validated_at` not null
101
+ - `task.phase.updated_at` not null
102
+
103
+ If Gate FAIL:
104
+ - Execute **FAIL**.