arreio 1.0.0-dev.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 (81) hide show
  1. package/README.md +81 -0
  2. package/package.json +42 -0
  3. package/scripts/postinstall.js +50 -0
  4. package/skills/arreio-init/SKILL.md +214 -0
  5. package/skills/arreio-init/references/architecture-template.md +85 -0
  6. package/skills/arreio-init/references/learn-index-template.md +15 -0
  7. package/skills/arreio-init/references/plan-index-template.md +29 -0
  8. package/skills/arreio-init/references/tasks-index-template.md +15 -0
  9. package/skills/learn/SKILL.md +151 -0
  10. package/skills/learn/modules/capture.md +108 -0
  11. package/skills/learn/modules/index.md +94 -0
  12. package/skills/learn/modules/maintain.md +116 -0
  13. package/skills/learn/modules/refine.md +104 -0
  14. package/skills/learn/references/dedup-rules.md +129 -0
  15. package/skills/learn/references/entry-schema.md +152 -0
  16. package/skills/learn/references/error-handling.md +178 -0
  17. package/skills/learn/references/id-generation.md +114 -0
  18. package/skills/learn/references/index-format.md +140 -0
  19. package/skills/learn/references/interaction-mode-propagation.md +89 -0
  20. package/skills/learn/references/migration-bootstrap.md +142 -0
  21. package/skills/learn/references/templates/artifacts/captured-entry.md +172 -0
  22. package/skills/learn/references/templates/artifacts/index-update.md +135 -0
  23. package/skills/learn/references/templates/artifacts/learn-input.md +100 -0
  24. package/skills/learn/references/templates/artifacts/maintain-log.md +142 -0
  25. package/skills/learn/references/templates/artifacts/refined-entry.md +168 -0
  26. package/skills/plan/SKILL.md +129 -0
  27. package/skills/plan/modules/design.md +140 -0
  28. package/skills/plan/modules/generate.md +156 -0
  29. package/skills/plan/modules/research.md +122 -0
  30. package/skills/plan/modules/scope.md +121 -0
  31. package/skills/plan/modules/tasks.md +190 -0
  32. package/skills/plan/references/design-complexity-assessment.md +118 -0
  33. package/skills/plan/references/error-handling.md +155 -0
  34. package/skills/plan/references/external-research-guidance.md +61 -0
  35. package/skills/plan/references/high-risk-detection.md +111 -0
  36. package/skills/plan/references/id-generation.md +55 -0
  37. package/skills/plan/references/interaction-mode-propagation.md +75 -0
  38. package/skills/plan/references/learnings-gate-logic.md +93 -0
  39. package/skills/plan/references/plan-tier-selection.md +174 -0
  40. package/skills/plan/references/task-slicing-rules.md +220 -0
  41. package/skills/plan/references/templates/artifacts/design.md +134 -0
  42. package/skills/plan/references/templates/artifacts/final-plan.md +265 -0
  43. package/skills/plan/references/templates/artifacts/research-findings.md +50 -0
  44. package/skills/plan/references/templates/artifacts/scoped-context.md +53 -0
  45. package/skills/plan/references/templates/artifacts/task.md +192 -0
  46. package/skills/plan/references/templates/artifacts/user-input.md +112 -0
  47. package/skills/review/SKILL.md +163 -0
  48. package/skills/review/modules/analyze.md +104 -0
  49. package/skills/review/modules/prepare.md +103 -0
  50. package/skills/review/modules/report.md +109 -0
  51. package/skills/review/modules/scope.md +126 -0
  52. package/skills/review/references/approval-criteria.md +101 -0
  53. package/skills/review/references/change-set-resolution.md +126 -0
  54. package/skills/review/references/error-handling.md +172 -0
  55. package/skills/review/references/id-generation.md +80 -0
  56. package/skills/review/references/interaction-mode-propagation.md +80 -0
  57. package/skills/review/references/review-categories.md +124 -0
  58. package/skills/review/references/scope-creep-detection.md +120 -0
  59. package/skills/review/references/severity-rubric.md +107 -0
  60. package/skills/review/references/templates/artifacts/findings.md +161 -0
  61. package/skills/review/references/templates/artifacts/review-input.md +116 -0
  62. package/skills/review/references/templates/artifacts/review-kit.md +135 -0
  63. package/skills/review/references/templates/artifacts/review-report.md +175 -0
  64. package/skills/review/references/templates/artifacts/review-scope.md +146 -0
  65. package/skills/work/SKILL.md +163 -0
  66. package/skills/work/modules/execute.md +109 -0
  67. package/skills/work/modules/prepare.md +140 -0
  68. package/skills/work/modules/review.md +164 -0
  69. package/skills/work/modules/triage.md +181 -0
  70. package/skills/work/references/ad-hoc-input-resolution.md +122 -0
  71. package/skills/work/references/error-handling.md +183 -0
  72. package/skills/work/references/execution-mode-selection.md +95 -0
  73. package/skills/work/references/id-generation.md +85 -0
  74. package/skills/work/references/interaction-mode-propagation.md +80 -0
  75. package/skills/work/references/review-checklist.md +94 -0
  76. package/skills/work/references/task-execution-rules.md +116 -0
  77. package/skills/work/references/templates/artifacts/execution-log.md +123 -0
  78. package/skills/work/references/templates/artifacts/execution-plan.md +111 -0
  79. package/skills/work/references/templates/artifacts/work-input.md +78 -0
  80. package/skills/work/references/templates/artifacts/work-manifest.md +119 -0
  81. package/skills/work/references/templates/artifacts/work-report.md +143 -0
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ ---
2
+ Title: Arreio
3
+ Type: Documentation
4
+ ---
5
+
6
+ **Arreio** (Brazilian word for _harness_) transforms agentic coding workflows into a predictable, safe, and high-quality software delivery pipeline.
7
+
8
+ By enforcing a **pragmatic**, guardrailed execution, Arreio brings structure to AI-driven development. Master just four core phases to orchestrate a highly reliable development cycle:
9
+
10
+ **Plan → Work → Review → Learn**
11
+
12
+ ## Installation
13
+
14
+ Install Arreio as a dependency to enable all skills in your workspace:
15
+
16
+ ```bash
17
+ npm install arreio
18
+ ```
19
+
20
+ The post-install script will automatically copy all Arreio skills to your `.agents/skills` directory. This makes all four core skills available in your AI development environment:
21
+
22
+ - **arreio-init** - Initialize projects to follow the Arreio workflow
23
+ - **plan** - Structure and decompose work into executable tasks
24
+ - **work** - Execute tasks with guardrailed implementation
25
+ - **review** - Conduct comprehensive code reviews
26
+ - **learn** - Capture and refine knowledge from completed work
27
+
28
+ ## Skill Based Workflow
29
+
30
+ **Arreio** orchestrates work through predictable skills that run in sequence:
31
+
32
+ Use /arreio-init to initialize a new project, to enable the project to follow the four phases of the Arreio workflows.
33
+
34
+ ### Plan
35
+
36
+ | Phase | Module Name | Purpose |
37
+ | ----- | ------------ | ----------------------------------------- |
38
+ | 1 | **scope** | Gather context, validate domain |
39
+ | 2 | **research** | Discover patterns, detect high-risk areas |
40
+ | 3 | **design** | Decompose into implementation units |
41
+ | 4 | **generate** | Select tier, render plan, save to docs |
42
+ | 5 | **tasks** | Slice plan into executable tasks |
43
+
44
+ ### Work
45
+
46
+ | Phase | Module Name | Purpose |
47
+ | ----- | ----------- | ----------------------------------------- |
48
+ | 1 | **triage** | Classify input and extract context |
49
+ | 2 | **prepare** | Set up environment, move task to progress |
50
+ | 3 | **execute** | Implement with test-first discipline |
51
+ | 4 | **review** | Code review, quality gates, move to done |
52
+
53
+ ### Review
54
+
55
+ | Phase | Module Name | Purpose |
56
+ | ----- | ----------- | -------------------------------- |
57
+ | 1 | **scope** | Classify input and scope review |
58
+ | 2 | **prepare** | Set up review environment |
59
+ | 3 | **analyze** | Execute code review, find issues |
60
+ | 4 | **report** | Report verdict |
61
+
62
+ ### Learn
63
+
64
+ | Phase | Module Name | Purpose |
65
+ | ----- | ------------ | ----------------------------------- |
66
+ | 1 | **capture** | Extract and capture knowledge entry |
67
+ | 2 | **refine** | Curate and refine the entry |
68
+ | 3 | **index** | Catalog and index the entry |
69
+ | 4 | **maintain** | Dedup, refresh, and prune entries |
70
+
71
+ ### Supporting Skills
72
+
73
+ We have designed a set of supporting skills to help you to manage your repository and work.
74
+
75
+ #### /arreio-init
76
+
77
+ Initialize a new project, enabling the project to follow the four phases of the Arreio workflows
78
+
79
+ #### /end-session
80
+
81
+ Preserve session context with a well-documented commit capturing state, decisions, and next steps.
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "arreio",
3
+ "version": "1.0.0-dev.1",
4
+ "description": "Arreio transforms agentic coding workflows into a predictable, safe, and high-quality software delivery pipeline. Master the four core phases—Plan, Work, Review, Learn—to orchestrate a highly reliable development cycle.",
5
+ "license": "MIT",
6
+ "author": "Wicttor",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/wicttor/arreio.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/wicttor/arreio/issues"
13
+ },
14
+ "homepage": "https://github.com/wicttor/arreio#readme",
15
+ "keywords": [
16
+ "arreio",
17
+ "agentic-workflows",
18
+ "ai-driven-development",
19
+ "software-delivery",
20
+ "plan-work-review-learn",
21
+ "guardrailed-execution",
22
+ "quality-assurance",
23
+ "code-review",
24
+ "documentation",
25
+ "workflow-orchestration"
26
+ ],
27
+ "main": "README.md",
28
+ "files": [
29
+ "skills/",
30
+ "scripts/",
31
+ "README.md"
32
+ ],
33
+ "scripts": {
34
+ "postinstall": "node scripts/postinstall.js"
35
+ },
36
+ "engines": {
37
+ "node": ">=14.0.0"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ }
42
+ }
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Post-install script for arreio
5
+ * Copies skills from the package to the user's .agents/skills directory
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const os = require('os');
11
+
12
+ // Determine the source and destination paths
13
+ const packageDir = path.dirname(__dirname);
14
+ const skillsSource = path.join(packageDir, 'skills');
15
+ const agentsDir = path.join(os.homedir(), '.agents');
16
+ const skillsDestination = path.join(agentsDir, 'skills');
17
+
18
+ // Function to recursively copy directories
19
+ function copyDirectory(src, dest) {
20
+ if (!fs.existsSync(dest)) {
21
+ fs.mkdirSync(dest, { recursive: true });
22
+ }
23
+
24
+ const files = fs.readdirSync(src);
25
+ files.forEach(file => {
26
+ const srcFile = path.join(src, file);
27
+ const destFile = path.join(dest, file);
28
+ const stat = fs.statSync(srcFile);
29
+
30
+ if (stat.isDirectory()) {
31
+ copyDirectory(srcFile, destFile);
32
+ } else {
33
+ fs.copyFileSync(srcFile, destFile);
34
+ }
35
+ });
36
+ }
37
+
38
+ try {
39
+ // Create .agents directory if it doesn't exist
40
+ if (!fs.existsSync(agentsDir)) {
41
+ fs.mkdirSync(agentsDir, { recursive: true });
42
+ }
43
+
44
+ // Copy skills to .agents/skills
45
+ copyDirectory(skillsSource, skillsDestination);
46
+ console.log(`✓ Arreio skills installed to ${skillsDestination}`);
47
+ } catch (error) {
48
+ console.error(`✗ Failed to install Arreio skills: ${error.message}`);
49
+ process.exit(1);
50
+ }
@@ -0,0 +1,214 @@
1
+ ---
2
+ name: arreio-init
3
+ description: "Initialize Arreio workflow system. Use when: setting up a new project for Arreio planning, learning, and task execution; preparing workspace before running plan/learn/work skills; bootstrapping project documentation structure."
4
+ argument-hint: "run to initialize workspace"
5
+ user-invocable: true
6
+ version: 1.1.0
7
+ timestamp: "2026-08-13"
8
+ ---
9
+
10
+ # Arreio Init
11
+
12
+ ## Purpose
13
+
14
+ **Arreio Init** bootstraps the complete Arreio workflow system for a project. It creates the required folder structure, index files, and architectural documentation that enable the downstream Arreio skills (plan, learn, work, review) to function correctly.
15
+
16
+ ## When to Use
17
+
18
+ Run this skill when:
19
+
20
+ - Setting up a **new project** for Arreio workflows
21
+ - **First time** using Arreio in an existing project
22
+ - After cloning a repo—to ensure all required files and folders are present
23
+ - Before invoking other Arreio skills (plan, learn, work, review)
24
+
25
+ ## Dependencies Enabled
26
+
27
+ After initialization, the following modules can operate:
28
+
29
+ - **Plan** (`plan/SKILL.md`) - Creates structured implementation plans
30
+ - **Learn** (`learn/SKILL.md`) - Extracts and organizes learnings
31
+ - **Work** (`work/SKILL.md`) - Executes implementation tasks
32
+ - **Review** (`review/SKILL.md`) - Analyzes code changes
33
+
34
+ ## Workflow
35
+
36
+ ### Step 1: Create Core Folder Structure
37
+
38
+ Creates the organizational spine for Arreio artifacts:
39
+
40
+ - `docs/plans/` — Stores generated plans and design artifacts
41
+ - `docs/learn/` — Stores extracted learnings and insights
42
+ - `docs/reports/` — Stores review reports and analysis
43
+ - `docs/tasks/` — Stores task lists and execution records
44
+ - `docs/archives/` — Stores historical artifacts
45
+
46
+ **Why:** Downstream skills assume these folders exist and will create files within them.
47
+
48
+ ### Step 2: Initialize Root Architecture Document
49
+
50
+ **File:** `ARCHITECTURE.md` (project root)
51
+
52
+ **Rationale:** Provides a single source of truth for project structure, principles, and design decisions. Other skills reference this for context.
53
+
54
+ **Action:** If `ARCHITECTURE.md` doesn't exist, create it using the [Architecture Template](references/architecture-template.md).
55
+
56
+ ### Step 3: Initialize Plans Index
57
+
58
+ **File:** `docs/plans/index.md`
59
+
60
+ **Rationale:** Central registry of all plans. The `plan/SKILL.md` module creates plan files and links them here.
61
+
62
+ **Action:** If `docs/plans/index.md` doesn't exist, create it using the [Plan Index Template](references/plan-index-template.md).
63
+
64
+ ### Step 4: Create Tasks Folder
65
+
66
+ **Folder:** `docs/tasks/`
67
+
68
+ **Rationale:** Root folder for task artifacts. The `plan/SKILL.md` Tasks phase will create per-plan subdirectories (`docs/tasks/<plan-id>/`) with their own indexes when tasks are generated.
69
+
70
+ **Action:** Create the `docs/tasks/` folder if it doesn't exist.
71
+
72
+ ### Step 5: Initialize Learning Index
73
+
74
+ **File:** `docs/learn/index.md`
75
+
76
+ **Rationale:** Central knowledge base index. The `learn/SKILL.md` module organizes learnings and cross-links them here.
77
+
78
+ **Action:** If `docs/learn/index.md` doesn't exist, create it using the [Learn Index Template](references/learn-index-template.md).
79
+
80
+ ### Step 6: Create Reports Folder
81
+
82
+ **Folder:** `docs/reports/`
83
+
84
+ **Rationale:** Stores review reports and analysis artifacts. The `review/SKILL.md` module generates reports here.
85
+
86
+ **Action:** Create the `docs/reports/` folder if it doesn't exist.
87
+
88
+ ### Step 7: Create Plan Skill Hidden Artifact Directories
89
+
90
+ **Folders:**
91
+
92
+ - `docs/plans/.scope/` — Stores Scope phase artifacts
93
+ - `docs/plans/.research/` — Stores Research phase artifacts
94
+ - `docs/plans/.design/` — Stores Design phase artifacts
95
+
96
+ **Rationale:** The `plan/SKILL.md` orchestrator saves intermediate phase artifacts in these hidden directories to preserve the planning trail and enable recovery/resumption.
97
+
98
+ **Action:** Create all three directories if they don't exist.
99
+
100
+ ### Step 8: Create Work Skill Hidden Artifact Directories
101
+
102
+ **Folders:**
103
+
104
+ - `docs/plans/.work/.triage/` — Stores Triage phase artifacts
105
+ - `docs/plans/.work/.prepare/` — Stores Prepare phase artifacts
106
+ - `docs/plans/.work/.execute/` — Stores Execute phase artifacts
107
+ - `docs/plans/.work/.review/` — Stores Review phase artifacts
108
+
109
+ **Rationale:** The `work/SKILL.md` orchestrator saves phase artifacts here during task execution to track work progress and decisions.
110
+
111
+ **Action:** Create all four directories if they don't exist.
112
+
113
+ ### Step 9: Create Review Skill Hidden Artifact Directories and Registry
114
+
115
+ **Folders:**
116
+
117
+ - `docs/plans/.review/.scope/` — Stores Review Scope phase artifacts
118
+ - `docs/plans/.review/.prepare/` — Stores Review Prepare phase artifacts
119
+ - `docs/plans/.review/.analyze/` — Stores Review Analyze phase artifacts
120
+ - `docs/plans/.review/.report/` — Stores Review Report phase artifacts
121
+
122
+ **File:**
123
+
124
+ - `docs/plans/.review/index.md` — Central registry of all review reports
125
+
126
+ **Rationale:** The `review/SKILL.md` orchestrator saves phase artifacts in these hidden directories and maintains a central index of all review reports.
127
+
128
+ **Action:** Create all four directories if they don't exist. If `docs/plans/.review/index.md` doesn't exist, create it with a header:
129
+
130
+ ```markdown
131
+ ---
132
+ type: "index"
133
+ title: "Review Reports Index"
134
+ description: "Central registry of all code review reports."
135
+ timestamp: "2026-07-03"
136
+ ---
137
+
138
+ ## Overview
139
+
140
+ This is the index of all review reports for the project. Reports are organized by review-id and linked from this registry.
141
+
142
+ ## Review Reports
143
+
144
+ <!-- Add new review reports below. Reports are generated by the `/review` skill. -->
145
+
146
+ _No review reports yet._
147
+ ```
148
+
149
+ ### Step 10: Create Learn Skill Hidden Artifact Directories
150
+
151
+ **Folders:**
152
+
153
+ - `docs/plans/.learn/.capture/` — Stores Capture phase artifacts
154
+ - `docs/plans/.learn/.refine/` — Stores Refine phase artifacts
155
+ - `docs/plans/.learn/.index/` — Stores Index phase artifacts
156
+ - `docs/plans/.learn/.maintain/` — Stores Maintain phase artifacts
157
+
158
+ **Rationale:** The `learn/SKILL.md` orchestrator saves phase artifacts in these hidden directories to preserve the knowledge entry authoring trail.
159
+
160
+ **Action:** Create all four directories if they don't exist.
161
+
162
+ ### Step 11: Create Learn Category Folders
163
+
164
+ **Folders:**
165
+
166
+ - `docs/learn/decision/` — Stores decision-type learnings
167
+ - `docs/learn/pattern/` — Stores pattern-type learnings
168
+ - `docs/learn/gotcha/` — Stores gotcha-type learnings
169
+ - `docs/learn/workflow/` — Stores workflow-type learnings
170
+
171
+ **Rationale:** The `learn/SKILL.md` skill organizes knowledge entries by type. These folders provide category structure for the learnings index.
172
+
173
+ **Action:** Create all four folders if they don't exist.
174
+
175
+ ## Success Criteria
176
+
177
+ After initialization, verify:
178
+
179
+ - ✓ All five core folders exist: `docs/plans/`, `docs/learn/`, `docs/reports/`, `docs/tasks/`, `docs/archives/`
180
+ - ✓ `ARCHITECTURE.md` exists at project root
181
+ - ✓ Root-level index files exist:
182
+ - `docs/plans/index.md` (registry of all plans)
183
+ - `docs/learn/index.md` (central knowledge base)
184
+ - ✓ Plan skill hidden artifact directories exist:
185
+ - `docs/plans/.scope/`, `docs/plans/.research/`, `docs/plans/.design/`
186
+ - ✓ Work skill hidden artifact directories exist:
187
+ - `docs/plans/.work/.triage/`, `docs/plans/.work/.prepare/`, `docs/plans/.work/.execute/`, `docs/plans/.work/.review/`
188
+ - ✓ Review skill hidden artifact directories exist:
189
+ - `docs/plans/.review/.scope/`, `docs/plans/.review/.prepare/`, `docs/plans/.review/.analyze/`, `docs/plans/.review/.report/`
190
+ - `docs/plans/.review/index.md` (review reports registry)
191
+ - ✓ Learn skill hidden artifact directories exist:
192
+ - `docs/plans/.learn/.capture/`, `docs/plans/.learn/.refine/`, `docs/plans/.learn/.index/`, `docs/plans/.learn/.maintain/`
193
+ - ✓ Learn category folders exist:
194
+ - `docs/learn/decision/`, `docs/learn/pattern/`, `docs/learn/gotcha/`, `docs/learn/workflow/`
195
+ - ✓ Per-plan task indexes created on-demand by plan skill: `docs/tasks/<plan-id>/index.md` (created when Tasks phase runs)
196
+ - ✓ You can now run all four Arreio skills (plan, work, review, learn) without setup errors
197
+
198
+ ## Self-Healing Behavior
199
+
200
+ Downstream skills (plan, learn, work, review) automatically create missing folders and indexes if arreio-init wasn't explicitly run:
201
+
202
+ - **plan** skill creates missing `docs/plans/` core folders, and allocates `docs/plans/.scope/`, `.research/`, `.design/` directories on first use.
203
+ - **work** skill creates missing `docs/plans/.work/` directories (`.triage/`, `.prepare/`, `.execute/`, `.review/`) on first execution.
204
+ - **review** skill creates missing `docs/plans/.review/` directories and `index.md` registry on first review.
205
+ - **learn** skill creates missing `docs/plans/.learn/` directories and `docs/learn/` category folders on first learning capture.
206
+
207
+ **However**, running `arreio-init` upfront provides several benefits:
208
+
209
+ - All directories are created consistently in one pass
210
+ - Ensures the project structure is fully initialized before any skill runs
211
+ - Provides a clear baseline for verification (no hidden "auto-created" surprises)
212
+ - Reduces latency of first skill invocation
213
+
214
+ Running arreio-init upfront is **recommended** for new projects, but not strictly required.
@@ -0,0 +1,85 @@
1
+ ---
2
+ title: "Architecture Template"
3
+ description: "A template for documenting the architecture of a software system, including system overview, core constraints, technology stack, architectural pattern, data flow, codebase map, component design philosophy, and operational guidelines."
4
+ type: Documentation
5
+ version: 1.0
6
+ timestamp: "2026-07-03"
7
+ ---
8
+
9
+ ````markdown
10
+ # Architecture Documentation
11
+
12
+ A bird's-eye view of the system design, boundaries, and codebase layout.
13
+
14
+ ---
15
+
16
+ ## 1. System Overview
17
+
18
+ - **Domain Problem**: [One-sentence explanation of what business problem this software solves]
19
+ - **Target Audience**: [Who uses this application and what they achieve with it]
20
+ - **Core Goal**: Provide an uncompromised, resilient system for [Primary Core Feature]
21
+
22
+ ## 2. Core Constraints (The "Don'ts")
23
+
24
+ - **No Shared State**: Context modules must remain fully isolated from each other.
25
+ - **No Direct DB Calls**: Frontend components must never query database instances.
26
+ - **No Third-Party Bleed**: Wrap external APIs inside internal adapters.
27
+ - **No Deep Inheritance**: Favor composition and simple utility interfaces over deep class trees.
28
+
29
+ ## 3. Technology Stack
30
+
31
+ | Layer | Technology | Primary Responsibility |
32
+ | :-------------- | :---------------- | :------------------------------------------- |
33
+ | **Frontend** | React / Next.js | Client UI and local state orchestration |
34
+ | **Backend API** | Node.js / Fastify | Request validation, business logic execution |
35
+ | **Database** | PostgreSQL | Relational storage and ACID transactions |
36
+ | **Caching** | Redis | Session state and global rate limiting |
37
+
38
+ ## 4. Architectural Pattern & Data Flow
39
+
40
+ The system follows a strict **Layered Architecture**. Data flows unidirectionally from the User Interface down to the Storage Layer.
41
+
42
+ ```mermaid
43
+ graph TD
44
+ UI[User Interface] --> API[API Gateway / Router]
45
+ API --> Service[Service Logic Layer]
46
+ Service --> Data[Data Access Layer]
47
+ Data --> DB[(PostgreSQL Database)]
48
+
49
+ subgraph Boundaries
50
+ Service --> |Adapter| ExternalAPI[Third-Party Service]
51
+ end
52
+ ```
53
+
54
+ ## 5. Codebase Map
55
+
56
+ ```text
57
+ ├── src/
58
+ │ ├── config/ # Global application configurations and environment schemas
59
+ │ ├── entrypoints/ # System entry points (server.js, workers, cron triggers)
60
+ │ ├── domains/ # Vertical slices containing isolated business domains
61
+ │ │ └── billing/ # Example domain: Handles invoices, webhooks, subscriptions
62
+ │ │ ├── components/ # Domain-specific UI primitives
63
+ │ │ ├── services/ # Business rules and internal calculations
64
+ │ │ └── db/ # Queries, transactions, and tables
65
+ │ ├── shared/ # Globally accessible utility libraries and design systems
66
+ │ └── tests/ # Integration test suites and regression hooks
67
+ ```
68
+
69
+ ### Entry Points
70
+
71
+ - **HTTP Server**: `src/entrypoints/server.js` — Bootstraps the global API instance.
72
+ - **Worker Queue**: `src/entrypoints/worker.js` — Processes background tasks and retry loops.
73
+
74
+ ## 6. Component Design Philosophy
75
+
76
+ - **Thin Controllers**: Route handlers only validate inputs and delegate work immediately.
77
+ - **Fat Services**: Domain logic lives exclusively in pure, testable service functions.
78
+ - **Predictable UI**: Presentational components consume immutable properties; state changes bubble up via events.
79
+
80
+ ## 7. Operational Guidelines & Verification
81
+
82
+ - **Local Verification**: Execute `npm run check` to validate formatting, linting, and types before creating any pull request.
83
+ - **Test Isolation**: Database unit tests must spin up an ephemeral container instance to prevent state pollution.
84
+ - **State Updates**: Always modify domain states via explicit commands, never through structural cross-mutation.
85
+ ````
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Learn Index Template
3
+ description: Template for the Learn Index file, which serves as a central reference point for learning resources and documentation within the project.
4
+ type: Template
5
+ version: 1.0
6
+ timestamp: "2026-07-03"
7
+ ---
8
+
9
+ # Index of Learning Resources
10
+
11
+ This document serves as a central reference point for learning resources and documentation within the project. It is intended to help team members quickly find relevant information and guidance.
12
+
13
+ ```markdown
14
+ # Learning Resources Index
15
+ ```
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: "Plan Index Template"
3
+ description: "A template for the index of planning documents, providing an overview of the knowledge base and linking to specific concept documents."
4
+ type: Documentation
5
+ version: 1.0
6
+ timestamp: "2026-07-03"
7
+ ---
8
+
9
+ # Plan Index Template
10
+
11
+ Use the following template to create an index of planning documents in the `docs/plans/` directory. This index provides an overview of the knowledge base and links to specific concept documents.
12
+
13
+ ```markdown
14
+ ---
15
+ type: "index"
16
+ title: "Plan Index"
17
+ description: "An index of planning documents, providing an overview of the knowledge base and linking to specific concept documents."
18
+ timestamp: "2026-07-03"
19
+ ---
20
+
21
+ ## Overview
22
+
23
+ This is the index of planning documents for the project. It serves as a central reference point for all planning-related artifacts, concepts, and templates.
24
+
25
+ ## Plans
26
+
27
+ - [Plan Name 1](plan-one.md): Brief description of what this plan document contains. Task File: `docs/tasks/<task-id>/index.md`. STATUS: Active/Archived/Completed
28
+ - [Plan Name 2](plan-two.md): Brief description of what this plan document contains. Task File: `docs/tasks/<task-id>/index.md`. STATUS: Active/Archived/Completed
29
+ ```
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Tasks Index Template
3
+ description: Template for the Tasks Index file, which serves as a central reference point for task-related documentation and resources within the project.
4
+ type: Template
5
+ version: 1.0
6
+ timestamp: "2026-07-03"
7
+ ---
8
+
9
+ # Index of Tasks
10
+
11
+ This document serves as a central reference point for task-related documentation and resources within the project. It is intended to help team members quickly find relevant information and guidance.
12
+
13
+ ```markdown
14
+ # Tasks Index
15
+ ```