Skip to content

Commit 48775fe

Browse files
committed
feat(template): initial commit of autonomous development workflow patterns
- Complete command architecture (10 commands) - 7 production-ready skills (git-workflow, quality-gates, task-patterns, architect, worktree-manager, meta-skill, create-worktree) - Comprehensive documentation (BOOTSTRAP-PLAN, WORKFLOW, conventions) - Template configuration (.env.example) - Validated workflow (8.2/10 production ready) Enables ~80% AFK development with human gates at strategy approval and PR review. Ready for use in any project with Linear + GitHub integration.
0 parents  commit 48775fe

File tree

62 files changed

+24700
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+24700
-0
lines changed
Lines changed: 344 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,344 @@
1+
# Tempo MVP - Entity & Service Summary
2+
3+
**Purpose:** High-level reference for all entities and their service operations in the Tempo brain dump application.
4+
5+
---
6+
7+
## 1. User
8+
9+
**Purpose:** Sales reps and team members who use the system.
10+
11+
### Fields
12+
- `email` - Login credential
13+
- `first_name`, `last_name` - Display name
14+
- `password_hash` - Authentication
15+
- `is_active` - Account status
16+
17+
### UserService Methods
18+
19+
```python
20+
async def create(data: UserCreate) -> User
21+
# Create new user account with hashed password
22+
23+
async def authenticate(email: str, password: str) -> User | None
24+
# Validate credentials and return user if valid
25+
26+
async def get_by_email(email: str) -> User | None
27+
# Find user by email address
28+
29+
async def get_by_id(user_id: UUID) -> User | None
30+
# Get user by ID
31+
32+
async def update(user_id: UUID, data: UserUpdate) -> User
33+
# Update user profile fields
34+
35+
async def deactivate(user_id: UUID) -> User
36+
# Soft-delete user account
37+
```
38+
39+
---
40+
41+
## 2. Account
42+
43+
**Purpose:** The customer/deal being tracked. Central entity in the system.
44+
45+
### Fields
46+
- `name` - Company name
47+
- `stage` - Pipeline position (prospect, qualifying, presenting, closing, closed_won, closed_lost)
48+
- `actual_value` - Deal value ($)
49+
- `acv` - Annual contract value
50+
- `next_meeting` - Scheduled meeting date
51+
- `next_steps` - Manual next steps (user-entered)
52+
- `ai_next_steps` - AI-generated next steps
53+
- `ai_next_steps_generated_at` - When AI last updated
54+
- `owner_user_id` - Sales rep who owns this account
55+
- `metadata` - Flexible JSON for any additional data
56+
57+
### AccountService Methods
58+
59+
```python
60+
async def create(data: AccountCreate, owner_id: UUID) -> Account
61+
# Create new account with owner assignment
62+
# Triggers: Initial AI next steps generation
63+
64+
async def list(
65+
owner_id: UUID,
66+
stage: str | None = None,
67+
search: str | None = None,
68+
limit: int = 20,
69+
offset: int = 0
70+
) -> list[Account]
71+
# Get paginated, filtered list of accounts
72+
# Supports: stage filter, name search, pagination
73+
74+
async def get_by_id(account_id: UUID) -> Account | None
75+
# Get single account by ID
76+
77+
async def update(account_id: UUID, data: AccountUpdate) -> Account
78+
# Update account fields
79+
# Triggers: Activity log for field changes
80+
# Triggers: AI next steps regeneration if stage changed
81+
82+
async def transition_stage(account_id: UUID, new_stage: str) -> Account
83+
# Move account to new pipeline stage
84+
# Validates: Stage transition is allowed
85+
# Triggers: Stage change activity
86+
# Triggers: AI next steps regeneration
87+
88+
async def delete(account_id: UUID) -> None
89+
# Soft-delete account (sets archived flag)
90+
# Triggers: Deletion activity log
91+
92+
async def get_with_context(account_id: UUID) -> AccountWithContext
93+
# Get account with all activities, memories, pending updates
94+
# Used for: Account detail view
95+
```
96+
97+
---
98+
99+
## 3. Activity
100+
101+
**Purpose:** All interactions with an account. Polymorphic - stores meetings, emails, brain dumps, system events.
102+
103+
### Fields
104+
- `account_id` - Which account this relates to
105+
- `type` - Activity type (voice_capture, file_upload, text_paste, meeting, email_sent, email_received, call, note, field_change, stage_change)
106+
- `title` - Brief description
107+
- `content` - Full content (transcript, email body, notes)
108+
- `searchable_content` - Denormalized for full-text search
109+
- `occurred_at` - When this activity happened
110+
- `created_by_user_id` - Who created this
111+
- `data` - Type-specific JSON data (audio_url, attendees, etc.)
112+
113+
### ActivityService Methods
114+
115+
```python
116+
async def create(data: ActivityCreate) -> Activity
117+
# Create new activity
118+
# Sets: searchable_content for FTS
119+
# Triggers: AI processing (async)
120+
121+
async def list_by_account(
122+
account_id: UUID,
123+
activity_type: str | None = None,
124+
since: datetime | None = None,
125+
limit: int = 50
126+
) -> list[Activity]
127+
# Get activity timeline for account
128+
# Supports: Filter by type, get only new activities since timestamp
129+
# Used for: Timeline view and polling
130+
131+
async def create_voice_capture(
132+
account_id: UUID,
133+
audio_file: bytes,
134+
created_by_user_id: UUID
135+
) -> Activity
136+
# Upload voice recording
137+
# Creates: Activity with type=voice_capture
138+
# Triggers: Transcription job (async)
139+
# Triggers: AI processing after transcription
140+
141+
async def create_file_upload(
142+
account_id: UUID,
143+
file: bytes,
144+
filename: str,
145+
created_by_user_id: UUID
146+
) -> Activity
147+
# Upload document/file
148+
# Creates: Activity with type=file_upload
149+
# Triggers: Text extraction (if PDF/doc)
150+
# Triggers: AI processing
151+
152+
async def create_text_paste(
153+
account_id: UUID,
154+
text: str,
155+
created_by_user_id: UUID
156+
) -> Activity
157+
# Paste text from clipboard
158+
# Creates: Activity with type=text_paste
159+
# Triggers: AI processing immediately
160+
161+
async def log_field_change(
162+
account_id: UUID,
163+
field_name: str,
164+
old_value: Any,
165+
new_value: Any,
166+
changed_by_user_id: UUID
167+
) -> Activity
168+
# System-generated activity for field changes
169+
# Creates: Activity with type=field_change
170+
# Used for: Audit trail
171+
172+
async def log_stage_change(
173+
account_id: UUID,
174+
from_stage: str,
175+
to_stage: str,
176+
changed_by_user_id: UUID
177+
) -> Activity
178+
# System-generated activity for stage transitions
179+
# Creates: Activity with type=stage_change
180+
```
181+
182+
---
183+
184+
## 4. Memory
185+
186+
**Purpose:** AI-extracted persistent facts about accounts. "Bill doesn't like 8am meetings", "Need CFO approval".
187+
188+
### Fields
189+
- `account_id` - Which account this memory relates to
190+
- `content` - The actual insight/fact
191+
- `extracted_from_activity_id` - Which activity generated this
192+
- `extracted_at` - When AI extracted this
193+
- `is_active` - Can be deprecated over time
194+
195+
### MemoryService Methods
196+
197+
```python
198+
async def create(
199+
account_id: UUID,
200+
content: str,
201+
extracted_from_activity_id: UUID
202+
) -> Memory
203+
# Create new memory (called by AI processor)
204+
205+
async def list_by_account(account_id: UUID, active_only: bool = True) -> list[Memory]
206+
# Get all memories for account
207+
# Used for: Memory display, AI context aggregation
208+
209+
async def deactivate(memory_id: UUID) -> Memory
210+
# Mark memory as no longer relevant
211+
# Sets: is_active = False
212+
213+
async def search(query: str, limit: int = 20) -> list[Memory]
214+
# Full-text search across memories
215+
# Used for: Finding accounts with specific insights
216+
```
217+
218+
---
219+
220+
## 5. Update
221+
222+
**Purpose:** AI-suggested changes waiting for human approval. The approval queue.
223+
224+
### Fields
225+
- `account_id` - Which account to update
226+
- `field_name` - Which field to change (stage, actual_value, next_steps, etc.)
227+
- `old_value` - Current value
228+
- `new_value` - Proposed value
229+
- `source_activity_id` - Which activity triggered this
230+
- `status` - pending, approved, rejected
231+
- `reviewed_by_user_id` - Who reviewed
232+
- `reviewed_at` - When reviewed
233+
234+
### UpdateService Methods
235+
236+
```python
237+
async def create(
238+
account_id: UUID,
239+
field_name: str,
240+
old_value: Any,
241+
new_value: Any,
242+
source_activity_id: UUID
243+
) -> Update
244+
# Create suggested update (called by AI processor)
245+
# Creates: Update with status=pending
246+
247+
async def list_pending(user_id: UUID | None = None) -> list[Update]
248+
# Get all pending updates
249+
# Optionally: Filter by user's owned accounts
250+
# Used for: Updates approval view
251+
252+
async def approve(update_id: UUID, reviewed_by_user_id: UUID) -> Update
253+
# Approve update and apply changes
254+
# Updates: Account field with new value
255+
# Sets: status=approved, reviewed_by, reviewed_at
256+
# Triggers: Field change activity log
257+
258+
async def reject(update_id: UUID, reviewed_by_user_id: UUID) -> Update
259+
# Reject update without applying
260+
# Sets: status=rejected, reviewed_by, reviewed_at
261+
262+
async def approve_all(update_ids: list[UUID], reviewed_by_user_id: UUID) -> list[Update]
263+
# Bulk approve multiple updates
264+
# Used for: "Approve All" button
265+
```
266+
267+
---
268+
269+
## Key Workflows
270+
271+
### Brain Dump Flow
272+
```
273+
1. User uploads voice/file/text
274+
2. ActivityService.create_voice_capture/file_upload/text_paste()
275+
3. Background: Transcribe/extract text
276+
4. Trigger: AI Processing Workflow
277+
```
278+
279+
### AI Processing Workflow
280+
```
281+
1. Get all recent Activities for Account
282+
2. Send to AI:
283+
- Extract memories
284+
- Suggest field updates
285+
- Generate next steps
286+
3. MemoryService.create() for each memory
287+
4. UpdateService.create() for each suggested change
288+
5. AccountService.update() to set ai_next_steps
289+
```
290+
291+
### Update Approval Flow
292+
```
293+
1. User views pending updates
294+
2. User clicks "Approve" on update
295+
3. UpdateService.approve()
296+
- Applies change to Account
297+
- Logs activity
298+
- Updates status
299+
```
300+
301+
### Search Flow
302+
```
303+
1. User searches "pricing concerns"
304+
2. PostgreSQL full-text search on Activity.searchable_content
305+
3. Return matching Activities grouped by Account
306+
```
307+
308+
### Timeline Polling Flow
309+
```
310+
1. Frontend polls every 5 seconds
311+
2. ActivityService.list_by_account(since=last_fetch)
312+
3. Returns only new activities
313+
4. Frontend appends to timeline
314+
```
315+
316+
---
317+
318+
## Service Dependencies
319+
320+
**AccountService** depends on:
321+
- ActivityService (to log changes)
322+
- No other services
323+
324+
**ActivityService** depends on:
325+
- External: Transcription API (for voice)
326+
- External: Text extraction (for files)
327+
- Triggers: AI processing (async, doesn't block)
328+
329+
**MemoryService** depends on:
330+
- ActivityService (for provenance)
331+
332+
**UpdateService** depends on:
333+
- AccountService (to apply changes)
334+
- ActivityService (to log approval)
335+
336+
**AI Processing** depends on:
337+
- ActivityService (to fetch context)
338+
- MemoryService (to create memories)
339+
- UpdateService (to create suggestions)
340+
- AccountService (to update next steps)
341+
342+
---
343+
344+
**End of Document**

0 commit comments

Comments
 (0)