maestro-bundle 1.8.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +139 -169
- package/package.json +2 -2
- package/src/cli.mjs +75 -75
- package/templates/bundle-ai-agents/.spec/constitution.md +24 -24
- package/templates/bundle-ai-agents/AGENTS.md +71 -71
- package/templates/bundle-ai-agents/PRD_TEMPLATE.md +63 -63
- package/templates/bundle-ai-agents-deep/.spec/constitution.md +17 -17
- package/templates/bundle-ai-agents-deep/AGENTS.md +58 -58
- package/templates/bundle-ai-agents-deep/PRD_TEMPLATE.md +63 -63
- package/templates/bundle-ai-agents-deep/skills/deep-agent-memory/SKILL.md +158 -158
- package/templates/bundle-base/AGENTS.md +99 -99
- package/templates/bundle-data-pipeline/.spec/constitution.md +23 -23
- package/templates/bundle-data-pipeline/AGENTS.md +68 -68
- package/templates/bundle-data-pipeline/PRD_TEMPLATE.md +63 -63
- package/templates/bundle-frontend-spa/.spec/constitution.md +21 -21
- package/templates/bundle-frontend-spa/AGENTS.md +58 -58
- package/templates/bundle-frontend-spa/PRD_TEMPLATE.md +63 -63
- package/templates/bundle-jhipster-microservices/.spec/constitution.md +31 -31
- package/templates/bundle-jhipster-microservices/AGENTS.md +70 -70
- package/templates/bundle-jhipster-microservices/PRD_TEMPLATE.md +63 -63
- package/templates/bundle-jhipster-monorepo/.spec/constitution.md +22 -22
- package/templates/bundle-jhipster-monorepo/AGENTS.md +64 -64
- package/templates/bundle-jhipster-monorepo/PRD_TEMPLATE.md +63 -63
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: deep-agent-memory
|
|
3
|
-
description: Configure persistent memory for Deep Agents using AGENTS.md and LangGraph Store. Use when the agent needs to remember context across sessions, persist learnings, or maintain long-term knowledge.
|
|
4
|
-
version: 1.0.0
|
|
5
|
-
author: Maestro
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Deep Agent Memory
|
|
9
|
-
|
|
10
|
-
Give your Deep Agent persistent memory that survives across sessions using AGENTS.md files and LangGraph Store.
|
|
11
|
-
|
|
12
|
-
## When to Use
|
|
13
|
-
- When the agent should remember context between sessions
|
|
14
|
-
- When loading project-specific knowledge at startup
|
|
15
|
-
- When persisting learnings across threads
|
|
16
|
-
- When configuring AGENTS.md for persistent context
|
|
17
|
-
|
|
18
|
-
## Available Operations
|
|
19
|
-
1. Load AGENTS.md as persistent context
|
|
20
|
-
2. Configure LangGraph Store for cross-thread memory
|
|
21
|
-
3. Use CompositeBackend for memory routing
|
|
22
|
-
4. Persist agent learnings
|
|
23
|
-
|
|
24
|
-
## Multi-Step Workflow
|
|
25
|
-
|
|
26
|
-
### Step 1: AGENTS.md as Memory
|
|
27
|
-
|
|
28
|
-
```python
|
|
29
|
-
from deepagents import create_deep_agent
|
|
30
|
-
from deepagents.backends.utils import create_file_data
|
|
31
|
-
from langgraph.checkpoint.memory import MemorySaver
|
|
32
|
-
|
|
33
|
-
agents_md = """
|
|
34
|
-
# Project Context
|
|
35
|
-
|
|
36
|
-
## Architecture
|
|
37
|
-
This project uses Clean Architecture with Python FastAPI.
|
|
38
|
-
|
|
39
|
-
## Conventions
|
|
40
|
-
- Use Pydantic for all DTOs
|
|
41
|
-
- Pytest for testing
|
|
42
|
-
- Ruff for linting
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
agent = create_deep_agent(
|
|
46
|
-
model="anthropic:claude-sonnet-4-6",
|
|
47
|
-
memory=["/AGENTS.md"],
|
|
48
|
-
checkpointer=MemorySaver()
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
result = agent.invoke(
|
|
52
|
-
{
|
|
53
|
-
"messages": [{"role": "user", "content": "What architecture do we use?"}],
|
|
54
|
-
"files": {"/AGENTS.md": create_file_data(agents_md)}
|
|
55
|
-
},
|
|
56
|
-
config={"configurable": {"thread_id": "session-1"}}
|
|
57
|
-
)
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Step 2: Persistent Store Memory
|
|
61
|
-
|
|
62
|
-
```python
|
|
63
|
-
from deepagents import create_deep_agent
|
|
64
|
-
from deepagents.backends import StoreBackend
|
|
65
|
-
from langgraph.store.postgres import PostgresStore
|
|
66
|
-
from langgraph.checkpoint.postgres import PostgresSaver
|
|
67
|
-
|
|
68
|
-
# Production: PostgreSQL for both
|
|
69
|
-
store = PostgresStore(conn_string="postgresql://user:pass@localhost/agents")
|
|
70
|
-
checkpointer = PostgresSaver(conn_string="postgresql://user:pass@localhost/agents")
|
|
71
|
-
|
|
72
|
-
agent = create_deep_agent(
|
|
73
|
-
model="anthropic:claude-sonnet-4-6",
|
|
74
|
-
backend=lambda rt: StoreBackend(rt),
|
|
75
|
-
store=store,
|
|
76
|
-
checkpointer=checkpointer,
|
|
77
|
-
memory=["/AGENTS.md"]
|
|
78
|
-
)
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Step 3: CompositeBackend with Memory
|
|
82
|
-
|
|
83
|
-
```python
|
|
84
|
-
from deepagents.backends import CompositeBackend, StateBackend, StoreBackend
|
|
85
|
-
|
|
86
|
-
composite = lambda rt: CompositeBackend(
|
|
87
|
-
default=StateBackend(rt),
|
|
88
|
-
routes={
|
|
89
|
-
"/memories/": StoreBackend(rt), # Long-term memory: persistent
|
|
90
|
-
"/workspace/": StateBackend(rt), # Working files: ephemeral
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
agent = create_deep_agent(
|
|
95
|
-
backend=composite,
|
|
96
|
-
store=InMemoryStore()
|
|
97
|
-
)
|
|
98
|
-
# Agent writes to /memories/ for things it wants to remember
|
|
99
|
-
# Agent writes to /workspace/ for temporary work
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Step 4: Consistent Thread IDs
|
|
103
|
-
|
|
104
|
-
```python
|
|
105
|
-
# Same thread_id = same conversation context
|
|
106
|
-
config = {"configurable": {"thread_id": f"project-{project_id}"}}
|
|
107
|
-
|
|
108
|
-
# First invocation
|
|
109
|
-
agent.invoke({"messages": [msg1]}, config=config)
|
|
110
|
-
|
|
111
|
-
# Later invocation — agent remembers the first one
|
|
112
|
-
agent.invoke({"messages": [msg2]}, config=config)
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Step 5: Verify
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
python -c "
|
|
119
|
-
from deepagents import create_deep_agent
|
|
120
|
-
from langgraph.checkpoint.memory import MemorySaver
|
|
121
|
-
|
|
122
|
-
agent = create_deep_agent(checkpointer=MemorySaver())
|
|
123
|
-
config = {'configurable': {'thread_id': 'test-memory'}}
|
|
124
|
-
|
|
125
|
-
# First message
|
|
126
|
-
agent.invoke({'messages': [{'role': 'user', 'content': 'My name is João'}]}, config=config)
|
|
127
|
-
|
|
128
|
-
# Second message — should remember
|
|
129
|
-
result = agent.invoke({'messages': [{'role': 'user', 'content': 'What is my name?'}]}, config=config)
|
|
130
|
-
print(result['messages'][-1].content)
|
|
131
|
-
"
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Resources
|
|
135
|
-
- `references/memory-patterns.md` — Memory architecture patterns
|
|
136
|
-
|
|
137
|
-
## Examples
|
|
138
|
-
|
|
139
|
-
### Example 1: Project Context Memory
|
|
140
|
-
User asks: "Agent should know our project conventions"
|
|
141
|
-
Response approach:
|
|
142
|
-
1. Write AGENTS.md with conventions
|
|
143
|
-
2. Pass via `memory=["/AGENTS.md"]`
|
|
144
|
-
3. Agent loads it every session
|
|
145
|
-
|
|
146
|
-
### Example 2: Learning Memory
|
|
147
|
-
User asks: "Agent should remember what worked in previous sessions"
|
|
148
|
-
Response approach:
|
|
149
|
-
1. Use CompositeBackend with StoreBackend for `/memories/`
|
|
150
|
-
2. Agent writes learnings to `/memories/`
|
|
151
|
-
3. Next session, agent reads from `/memories/`
|
|
152
|
-
|
|
153
|
-
## Notes
|
|
154
|
-
- `checkpointer` is REQUIRED for memory to persist
|
|
155
|
-
- AGENTS.md follows the agents.md standard (https://agents.md/)
|
|
156
|
-
- Use PostgresStore for production, InMemoryStore for dev
|
|
157
|
-
- Thread ID determines conversation scope
|
|
158
|
-
- Memory files are loaded at session start
|
|
1
|
+
---
|
|
2
|
+
name: deep-agent-memory
|
|
3
|
+
description: Configure persistent memory for Deep Agents using AGENTS.md and LangGraph Store. Use when the agent needs to remember context across sessions, persist learnings, or maintain long-term knowledge.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
author: Maestro
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Deep Agent Memory
|
|
9
|
+
|
|
10
|
+
Give your Deep Agent persistent memory that survives across sessions using AGENTS.md files and LangGraph Store.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
- When the agent should remember context between sessions
|
|
14
|
+
- When loading project-specific knowledge at startup
|
|
15
|
+
- When persisting learnings across threads
|
|
16
|
+
- When configuring AGENTS.md for persistent context
|
|
17
|
+
|
|
18
|
+
## Available Operations
|
|
19
|
+
1. Load AGENTS.md as persistent context
|
|
20
|
+
2. Configure LangGraph Store for cross-thread memory
|
|
21
|
+
3. Use CompositeBackend for memory routing
|
|
22
|
+
4. Persist agent learnings
|
|
23
|
+
|
|
24
|
+
## Multi-Step Workflow
|
|
25
|
+
|
|
26
|
+
### Step 1: AGENTS.md as Memory
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from deepagents import create_deep_agent
|
|
30
|
+
from deepagents.backends.utils import create_file_data
|
|
31
|
+
from langgraph.checkpoint.memory import MemorySaver
|
|
32
|
+
|
|
33
|
+
agents_md = """
|
|
34
|
+
# Project Context
|
|
35
|
+
|
|
36
|
+
## Architecture
|
|
37
|
+
This project uses Clean Architecture with Python FastAPI.
|
|
38
|
+
|
|
39
|
+
## Conventions
|
|
40
|
+
- Use Pydantic for all DTOs
|
|
41
|
+
- Pytest for testing
|
|
42
|
+
- Ruff for linting
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
agent = create_deep_agent(
|
|
46
|
+
model="anthropic:claude-sonnet-4-6",
|
|
47
|
+
memory=["/AGENTS.md"],
|
|
48
|
+
checkpointer=MemorySaver()
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
result = agent.invoke(
|
|
52
|
+
{
|
|
53
|
+
"messages": [{"role": "user", "content": "What architecture do we use?"}],
|
|
54
|
+
"files": {"/AGENTS.md": create_file_data(agents_md)}
|
|
55
|
+
},
|
|
56
|
+
config={"configurable": {"thread_id": "session-1"}}
|
|
57
|
+
)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Step 2: Persistent Store Memory
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from deepagents import create_deep_agent
|
|
64
|
+
from deepagents.backends import StoreBackend
|
|
65
|
+
from langgraph.store.postgres import PostgresStore
|
|
66
|
+
from langgraph.checkpoint.postgres import PostgresSaver
|
|
67
|
+
|
|
68
|
+
# Production: PostgreSQL for both
|
|
69
|
+
store = PostgresStore(conn_string="postgresql://user:pass@localhost/agents")
|
|
70
|
+
checkpointer = PostgresSaver(conn_string="postgresql://user:pass@localhost/agents")
|
|
71
|
+
|
|
72
|
+
agent = create_deep_agent(
|
|
73
|
+
model="anthropic:claude-sonnet-4-6",
|
|
74
|
+
backend=lambda rt: StoreBackend(rt),
|
|
75
|
+
store=store,
|
|
76
|
+
checkpointer=checkpointer,
|
|
77
|
+
memory=["/AGENTS.md"]
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Step 3: CompositeBackend with Memory
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from deepagents.backends import CompositeBackend, StateBackend, StoreBackend
|
|
85
|
+
|
|
86
|
+
composite = lambda rt: CompositeBackend(
|
|
87
|
+
default=StateBackend(rt),
|
|
88
|
+
routes={
|
|
89
|
+
"/memories/": StoreBackend(rt), # Long-term memory: persistent
|
|
90
|
+
"/workspace/": StateBackend(rt), # Working files: ephemeral
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
agent = create_deep_agent(
|
|
95
|
+
backend=composite,
|
|
96
|
+
store=InMemoryStore()
|
|
97
|
+
)
|
|
98
|
+
# Agent writes to /memories/ for things it wants to remember
|
|
99
|
+
# Agent writes to /workspace/ for temporary work
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Step 4: Consistent Thread IDs
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
# Same thread_id = same conversation context
|
|
106
|
+
config = {"configurable": {"thread_id": f"project-{project_id}"}}
|
|
107
|
+
|
|
108
|
+
# First invocation
|
|
109
|
+
agent.invoke({"messages": [msg1]}, config=config)
|
|
110
|
+
|
|
111
|
+
# Later invocation — agent remembers the first one
|
|
112
|
+
agent.invoke({"messages": [msg2]}, config=config)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Step 5: Verify
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
python -c "
|
|
119
|
+
from deepagents import create_deep_agent
|
|
120
|
+
from langgraph.checkpoint.memory import MemorySaver
|
|
121
|
+
|
|
122
|
+
agent = create_deep_agent(checkpointer=MemorySaver())
|
|
123
|
+
config = {'configurable': {'thread_id': 'test-memory'}}
|
|
124
|
+
|
|
125
|
+
# First message
|
|
126
|
+
agent.invoke({'messages': [{'role': 'user', 'content': 'My name is João'}]}, config=config)
|
|
127
|
+
|
|
128
|
+
# Second message — should remember
|
|
129
|
+
result = agent.invoke({'messages': [{'role': 'user', 'content': 'What is my name?'}]}, config=config)
|
|
130
|
+
print(result['messages'][-1].content)
|
|
131
|
+
"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Resources
|
|
135
|
+
- `references/memory-patterns.md` — Memory architecture patterns
|
|
136
|
+
|
|
137
|
+
## Examples
|
|
138
|
+
|
|
139
|
+
### Example 1: Project Context Memory
|
|
140
|
+
User asks: "Agent should know our project conventions"
|
|
141
|
+
Response approach:
|
|
142
|
+
1. Write AGENTS.md with conventions
|
|
143
|
+
2. Pass via `memory=["/AGENTS.md"]`
|
|
144
|
+
3. Agent loads it every session
|
|
145
|
+
|
|
146
|
+
### Example 2: Learning Memory
|
|
147
|
+
User asks: "Agent should remember what worked in previous sessions"
|
|
148
|
+
Response approach:
|
|
149
|
+
1. Use CompositeBackend with StoreBackend for `/memories/`
|
|
150
|
+
2. Agent writes learnings to `/memories/`
|
|
151
|
+
3. Next session, agent reads from `/memories/`
|
|
152
|
+
|
|
153
|
+
## Notes
|
|
154
|
+
- `checkpointer` is REQUIRED for memory to persist
|
|
155
|
+
- AGENTS.md follows the agents.md standard (https://agents.md/)
|
|
156
|
+
- Use PostgresStore for production, InMemoryStore for dev
|
|
157
|
+
- Thread ID determines conversation scope
|
|
158
|
+
- Memory files are loaded at session start
|
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
# Bundle Base —
|
|
1
|
+
# Bundle Base — Organization Standards
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is the base bundle that ALL developers must use. It defines the organization's non-negotiable standards.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## FUNDAMENTAL RULE: Specification-Driven Development (SDD)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
This project uses **GitHub Spec Kit** for governance. Every demand — new or in progress — MUST follow the SDD flow. No spec, no code. This is not optional.
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### Before writing any code:
|
|
10
10
|
|
|
11
|
-
1. `/speckit.constitution` —
|
|
12
|
-
2. `/speckit.specify` —
|
|
13
|
-
3. `/speckit.plan` —
|
|
14
|
-
4. `/speckit.tasks` —
|
|
15
|
-
5. `/speckit.implement` —
|
|
11
|
+
1. `/speckit.constitution` — Define principles (only the first time for the project)
|
|
12
|
+
2. `/speckit.specify` — Describe WHAT to build and WHY (never the how)
|
|
13
|
+
3. `/speckit.plan` — Plan architecture, stack, and technical decisions
|
|
14
|
+
4. `/speckit.tasks` — Break down into atomic implementable tasks
|
|
15
|
+
5. `/speckit.implement` — Execute the tasks following the plan
|
|
16
16
|
|
|
17
17
|
### Anti-vibing code
|
|
18
18
|
|
|
19
|
-
Vibing code
|
|
19
|
+
Vibing code is when someone starts coding without a spec, without a plan, without tasks — just "winging it". This is forbidden in this project. If the user asks to implement something and no spec exists:
|
|
20
20
|
|
|
21
|
-
1. **
|
|
22
|
-
2.
|
|
23
|
-
3.
|
|
24
|
-
4.
|
|
21
|
+
1. **STOP**. Do not write code.
|
|
22
|
+
2. Inform them that a spec needs to be created first.
|
|
23
|
+
3. Run `/speckit.specify` to start the process.
|
|
24
|
+
4. Only after having spec → plan → tasks, begin implementing.
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
- `.specify/specs/`
|
|
28
|
-
-
|
|
29
|
-
-
|
|
26
|
+
If the demand is already in progress (spec already exists), check:
|
|
27
|
+
- `.specify/specs/` contains the feature spec?
|
|
28
|
+
- The plan exists in `plan.md`?
|
|
29
|
+
- The tasks are in `tasks.md`?
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
If yes, continue from where you left off. If not, create the spec before proceeding.
|
|
32
32
|
|
|
33
|
-
###
|
|
33
|
+
### New demand vs in-progress demand
|
|
34
34
|
|
|
35
|
-
|
|
|
35
|
+
| Situation | What to do |
|
|
36
36
|
|---|---|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
| Refactoring |
|
|
37
|
+
| New demand, no spec | `/speckit.specify` → `/speckit.plan` → `/speckit.tasks` → `/speckit.implement` |
|
|
38
|
+
| Demand with spec but no plan | `/speckit.plan` → `/speckit.tasks` → `/speckit.implement` |
|
|
39
|
+
| Demand with plan and tasks | `/speckit.implement` (continue from where you left off) |
|
|
40
|
+
| Simple bug fix | Can fix directly, but document in the spec if it affects the plan |
|
|
41
|
+
| Refactoring | Create spec if it affects architecture; if cosmetic, can do directly |
|
|
42
42
|
|
|
43
|
-
##
|
|
43
|
+
## Who you are
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
You are a development assistant that strictly follows the organization's standards. All code produced must adhere to the conventions below. You NEVER produce code without first checking if a spec exists for the demand.
|
|
46
46
|
|
|
47
|
-
##
|
|
47
|
+
## Code Standards
|
|
48
48
|
|
|
49
|
-
###
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
49
|
+
### General
|
|
50
|
+
- Maximum of 500 lines per file
|
|
51
|
+
- Functions with a maximum of 20 lines
|
|
52
|
+
- Descriptive variable and function names (never `d`, `x`, `tmp`)
|
|
53
|
+
- Use the language's native functions for string manipulation
|
|
54
|
+
- Avoid nested ifs (hadouken) — use early returns and guard clauses
|
|
55
|
+
- Handle exception flows, not just the happy path
|
|
56
|
+
- Do not leave dead code, TODO comments without a deadline, or debug prints
|
|
57
57
|
|
|
58
58
|
### Python
|
|
59
|
-
-
|
|
60
|
-
- Type hints
|
|
61
|
-
- Docstrings
|
|
62
|
-
- Black
|
|
59
|
+
- Use f-strings for interpolation
|
|
60
|
+
- Type hints on all public functions
|
|
61
|
+
- Docstrings only on complex (non-obvious) functions
|
|
62
|
+
- Black for formatting, Ruff for linting
|
|
63
63
|
|
|
64
64
|
### TypeScript
|
|
65
|
-
- Strict mode
|
|
66
|
-
- Interfaces
|
|
67
|
-
- Async/await
|
|
65
|
+
- Strict mode enabled
|
|
66
|
+
- Interfaces over types when possible
|
|
67
|
+
- Async/await over .then()
|
|
68
68
|
|
|
69
69
|
### Java
|
|
70
|
-
-
|
|
71
|
-
- Records
|
|
72
|
-
- Optional
|
|
70
|
+
- Follow Google Java Style Guide conventions
|
|
71
|
+
- Records for immutable DTOs
|
|
72
|
+
- Optional instead of null
|
|
73
73
|
|
|
74
|
-
##
|
|
74
|
+
## Git Standards
|
|
75
75
|
|
|
76
76
|
### Branches
|
|
77
|
-
- `main` —
|
|
78
|
-
- `develop` —
|
|
79
|
-
- `feature/<
|
|
80
|
-
- `fix/<
|
|
81
|
-
- `hotfix/<
|
|
77
|
+
- `main` — production, protected
|
|
78
|
+
- `develop` — integration
|
|
79
|
+
- `feature/<scope>-<description>` — new features
|
|
80
|
+
- `fix/<scope>-<description>` — bug fixes
|
|
81
|
+
- `hotfix/<description>` — urgent production fixes
|
|
82
82
|
|
|
83
83
|
### Commits
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- `feat` —
|
|
88
|
-
- `fix` —
|
|
89
|
-
- `refactor` —
|
|
90
|
-
- `docs` —
|
|
91
|
-
- `test` —
|
|
92
|
-
- `chore` —
|
|
93
|
-
- `ci` —
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
Format: `<type>(<scope>): <description>`
|
|
85
|
+
|
|
86
|
+
Allowed types:
|
|
87
|
+
- `feat` — new feature
|
|
88
|
+
- `fix` — bug fix
|
|
89
|
+
- `refactor` — refactoring without behavior change
|
|
90
|
+
- `docs` — documentation
|
|
91
|
+
- `test` — adding or fixing tests
|
|
92
|
+
- `chore` — maintenance tasks
|
|
93
|
+
- `ci` — CI/CD changes
|
|
94
|
+
|
|
95
|
+
Examples:
|
|
96
96
|
```
|
|
97
|
-
feat(auth):
|
|
98
|
-
fix(api):
|
|
99
|
-
refactor(domain):
|
|
97
|
+
feat(auth): implement JWT authentication
|
|
98
|
+
fix(api): fix timeout in user search
|
|
99
|
+
refactor(domain): extract value object for CPF
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
### Pull Requests
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
103
|
+
- Short title (< 70 characters)
|
|
104
|
+
- Description with: summary, motivation, how to test
|
|
105
|
+
- Always link to the task/issue
|
|
106
|
+
- Minimum 1 reviewer
|
|
107
107
|
|
|
108
|
-
##
|
|
108
|
+
## Security
|
|
109
109
|
|
|
110
|
-
-
|
|
111
|
-
- Rate limiting
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
- HTTPS
|
|
110
|
+
- NEVER commit secrets (.env, credentials, API keys)
|
|
111
|
+
- Rate limiting on all APIs
|
|
112
|
+
- Validate inputs at system boundaries (API, UI)
|
|
113
|
+
- Follow OWASP Top 10
|
|
114
|
+
- HTTPS mandatory
|
|
115
115
|
|
|
116
|
-
##
|
|
116
|
+
## Tests
|
|
117
117
|
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
118
|
+
- Minimum coverage: 80% on domain code
|
|
119
|
+
- Unit tests for business rules
|
|
120
|
+
- Integration tests for repositories and APIs
|
|
121
|
+
- Name tests descriptively: `should_return_error_when_email_is_invalid`
|
|
122
122
|
|
|
123
|
-
##
|
|
123
|
+
## Project Structure
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
Organize by domain/feature, not by technical type:
|
|
126
126
|
|
|
127
127
|
```
|
|
128
|
-
#
|
|
128
|
+
# GOOD — by domain
|
|
129
129
|
src/
|
|
130
130
|
├── demands/
|
|
131
131
|
├── bundles/
|
|
132
132
|
├── agents/
|
|
133
133
|
└── tracking/
|
|
134
134
|
|
|
135
|
-
#
|
|
135
|
+
# BAD — by technical layer
|
|
136
136
|
src/
|
|
137
137
|
├── controllers/
|
|
138
138
|
├── services/
|
|
@@ -140,17 +140,17 @@ src/
|
|
|
140
140
|
└── models/
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
##
|
|
143
|
+
## Documentation
|
|
144
144
|
|
|
145
|
-
- README.md
|
|
146
|
-
- ADRs
|
|
147
|
-
-
|
|
145
|
+
- README.md at the root with: purpose, how to run, how to test
|
|
146
|
+
- ADRs for significant architectural decisions
|
|
147
|
+
- Diagrams as code (Mermaid) versioned in the repo
|
|
148
148
|
|
|
149
|
-
##
|
|
149
|
+
## What NOT to do
|
|
150
150
|
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
151
|
+
- Do not use `any` in TypeScript
|
|
152
|
+
- Do not ignore errors with empty try/catch
|
|
153
|
+
- Do not push directly to main
|
|
154
|
+
- Do not create generic utils/helpers "for the future"
|
|
155
|
+
- Do not install dependencies without justification
|
|
156
|
+
- Do not do "vibing coding" — always have an associated task/spec
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
# Constitution —
|
|
1
|
+
# Constitution — Data and ML Pipeline Project
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Principles
|
|
4
4
|
|
|
5
|
-
1. **Spec
|
|
6
|
-
2. **
|
|
7
|
-
3. **
|
|
8
|
-
4. **Baseline
|
|
9
|
-
5. **Notebook
|
|
5
|
+
1. **Spec first, code later** — Every demand goes through the SDD flow before implementation
|
|
6
|
+
2. **Original data is immutable** — Never edit data in `raw/`
|
|
7
|
+
3. **Reproducibility** — Every pipeline must be reproducible with same input = same output
|
|
8
|
+
4. **Baseline mandatory** — Every model needs a baseline for comparison
|
|
9
|
+
5. **Notebook for exploration, script for production** — Refactor before merge
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Development Standards
|
|
12
12
|
|
|
13
13
|
- Python 3.11+, type hints, Black + Ruff
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- Experiment tracking
|
|
14
|
+
- Pure functions for transformations (input -> output)
|
|
15
|
+
- Schema validation at each step (Pandera)
|
|
16
|
+
- Dataset versioning with DVC
|
|
17
|
+
- Experiment tracking with MLflow
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## ML Standards
|
|
20
20
|
|
|
21
|
-
- Cross-validation k=5
|
|
22
|
-
-
|
|
23
|
-
- Feature importance
|
|
24
|
-
-
|
|
25
|
-
- A/B testing
|
|
21
|
+
- Cross-validation k=5 minimum
|
|
22
|
+
- Metrics documented in MLflow
|
|
23
|
+
- Feature importance recorded
|
|
24
|
+
- Consistent random seed
|
|
25
|
+
- A/B testing before replacing model
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Quality Standards
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
- Commits
|
|
29
|
+
- Schema tests for transformations
|
|
30
|
+
- Regression tests for metrics
|
|
31
|
+
- Minimum coverage: 80% on pipelines
|
|
32
|
+
- Commits follow Conventional Commits
|