forked from cardosofelipe/fast-next-template
fix: Resolve ADR/Requirements inconsistencies from comprehensive review
## ADR Compliance Section Fixes - ADR-007: Fixed invalid NFR-501 and TC-002 references - NFR-501 → NFR-402 (Fault tolerance) - TC-002 → Core Principle (self-hostability) - ADR-008: Fixed invalid NFR-501 reference - Added TC-006 (pgvector extension) - ADR-011: Fixed invalid FR-201-205 and NFR-201 references - Now correctly references FR-401-404 (Issue Tracking series) - ADR-012: Fixed invalid FR-401, FR-402, NFR-302 references - Now references new FR-800 series (Cost & Budget Management) - ADR-014: Fixed invalid FR-601-605 and FR-102 references - Now correctly references FR-203 (Autonomy Level Configuration) ## ADR-007 Model Identifier Fix - Changed "claude-sonnet-4-20250514" to "claude-3-5-sonnet-latest" - Matches documented primary model (Claude 3.5 Sonnet) ## New Requirements Added - FR-801: Real-time cost tracking - FR-802: Budget configuration (soft/hard limits) - FR-803: Budget alerts - FR-804: Cost analytics This resolves all HIGH priority inconsistencies identified by the 4-agent parallel review of ADRs against requirements and architecture. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -297,7 +297,7 @@ def create_agent_graph() -> StateGraph:
|
||||
# 4. LiteLLM handles LLM calls with failover
|
||||
async def think_node(state: AgentState) -> AgentState:
|
||||
response = await litellm.acompletion(
|
||||
model="claude-sonnet-4-20250514",
|
||||
model="claude-3-5-sonnet-latest", # Claude 3.5 Sonnet (primary)
|
||||
messages=state["messages"],
|
||||
fallbacks=["gpt-4-turbo", "ollama/llama3"],
|
||||
metadata={"agent_id": state["agent_id"]},
|
||||
@@ -373,11 +373,11 @@ class StoryWorkflow(Machine):
|
||||
## Compliance
|
||||
|
||||
This decision aligns with:
|
||||
- **FR-101-105**: Agent orchestration requirements
|
||||
- **FR-101-105**: Agent management requirements (Type-Instance pattern)
|
||||
- **FR-301-305**: Workflow execution requirements
|
||||
- **NFR-501**: Self-hosting requirement (all components MIT/BSD licensed)
|
||||
- **NFR-402**: Fault tolerance (workflow durability, crash recovery)
|
||||
- **TC-001**: PostgreSQL as primary database
|
||||
- **TC-002**: Redis for caching and messaging
|
||||
- **Core Principle**: Self-hostability (all components MIT/BSD licensed)
|
||||
|
||||
## Alternatives Not Chosen
|
||||
|
||||
|
||||
@@ -162,8 +162,9 @@ If scale requires it, migrate to Qdrant (self-hosted, open-source) with the same
|
||||
|
||||
This decision aligns with:
|
||||
- FR-103: Agent domain knowledge (RAG)
|
||||
- NFR-501: Self-hostability requirement
|
||||
- TC-001: PostgreSQL as primary database
|
||||
- TC-006: pgvector extension required
|
||||
- Core Principle: Self-hostability (pgvector is open source)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -224,8 +224,10 @@ def process_sync_outbox():
|
||||
## Compliance
|
||||
|
||||
This decision aligns with:
|
||||
- FR-201-205: Issue tracking integration
|
||||
- NFR-201: Multi-provider support
|
||||
- FR-401: Issue hierarchy
|
||||
- FR-402: External issue synchronization
|
||||
- FR-403: Issue CRUD operations
|
||||
- NFR-201: Horizontal scalability (multi-provider architecture)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -190,9 +190,12 @@ GROUP BY project_id, DATE(timestamp);
|
||||
## Compliance
|
||||
|
||||
This decision aligns with:
|
||||
- FR-401: Cost tracking per agent/project
|
||||
- FR-402: Budget enforcement
|
||||
- NFR-302: Budget alert system
|
||||
- FR-801: Real-time cost tracking
|
||||
- FR-802: Budget configuration (soft/hard limits)
|
||||
- FR-803: Budget alerts
|
||||
- FR-804: Cost analytics
|
||||
- NFR-602: Logging and monitoring (cost observability)
|
||||
- BR-002: Cost overruns from API usage (risk mitigation)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -272,8 +272,9 @@ class ApprovalContextBuilder:
|
||||
## Compliance
|
||||
|
||||
This decision aligns with:
|
||||
- FR-601-605: Human-in-the-loop requirements
|
||||
- FR-102: Autonomy level configuration
|
||||
- FR-203: Autonomy level configuration
|
||||
- FR-301-305: Workflow checkpoints (approval gates at workflow boundaries)
|
||||
- NFR-402: Fault tolerance (approval state persistence)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -806,6 +806,77 @@ Each agent type represents a specialized role in the software development lifecy
|
||||
- [ ] AC-703.5: Test documentation (how to run, what's covered)
|
||||
- [ ] AC-703.6: Performance test results (if applicable)
|
||||
|
||||
### 4.8 Cost & Budget Management (FR-800 Series)
|
||||
|
||||
#### FR-801: Real-Time Cost Tracking
|
||||
|
||||
| Attribute | Value |
|
||||
|-----------|-------|
|
||||
| **ID** | FR-801 |
|
||||
| **Title** | Real-Time Cost Tracking |
|
||||
| **Description** | System shall track LLM API costs per agent, project, and sprint in real-time |
|
||||
| **Priority** | Must Have |
|
||||
| **Dependencies** | FR-102 |
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] AC-801.1: Token usage captured for every LLM call
|
||||
- [ ] AC-801.2: Cost calculated using provider pricing
|
||||
- [ ] AC-801.3: Cost attributed to agent, project, and sprint
|
||||
- [ ] AC-801.4: Real-time cost dashboard updates via SSE
|
||||
- [ ] AC-801.5: Historical cost data persisted for analytics
|
||||
- [ ] AC-801.6: Cost breakdown by model type available
|
||||
|
||||
#### FR-802: Budget Configuration
|
||||
|
||||
| Attribute | Value |
|
||||
|-----------|-------|
|
||||
| **ID** | FR-802 |
|
||||
| **Title** | Budget Configuration |
|
||||
| **Description** | System shall support configurable budget limits per project with soft and hard enforcement |
|
||||
| **Priority** | Must Have |
|
||||
| **Dependencies** | FR-801 |
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] AC-802.1: Daily, weekly, and monthly budget limits configurable
|
||||
- [ ] AC-802.2: Soft limits trigger alerts and model downgrades
|
||||
- [ ] AC-802.3: Hard limits block LLM requests
|
||||
- [ ] AC-802.4: Budget inheritance from organization to project
|
||||
- [ ] AC-802.5: Budget override capability for administrators
|
||||
|
||||
#### FR-803: Budget Alerts
|
||||
|
||||
| Attribute | Value |
|
||||
|-----------|-------|
|
||||
| **ID** | FR-803 |
|
||||
| **Title** | Budget Alerts |
|
||||
| **Description** | System shall send notifications when budget thresholds are approached or exceeded |
|
||||
| **Priority** | Should Have |
|
||||
| **Dependencies** | FR-801, FR-802 |
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] AC-803.1: Configurable alert thresholds (e.g., 50%, 80%, 100%)
|
||||
- [ ] AC-803.2: SSE notifications for real-time alerts
|
||||
- [ ] AC-803.3: Email notifications for budget events
|
||||
- [ ] AC-803.4: Alert history logged in audit trail
|
||||
- [ ] AC-803.5: Auto-downgrade to cheaper models on soft limit
|
||||
|
||||
#### FR-804: Cost Analytics
|
||||
|
||||
| Attribute | Value |
|
||||
|-----------|-------|
|
||||
| **ID** | FR-804 |
|
||||
| **Title** | Cost Analytics |
|
||||
| **Description** | System shall provide cost analytics and optimization recommendations |
|
||||
| **Priority** | Nice to Have |
|
||||
| **Dependencies** | FR-801 |
|
||||
|
||||
**Acceptance Criteria:**
|
||||
- [ ] AC-804.1: Cost trends visualization (daily, weekly, monthly)
|
||||
- [ ] AC-804.2: Cost comparison across projects
|
||||
- [ ] AC-804.3: Agent efficiency metrics (cost per task)
|
||||
- [ ] AC-804.4: Model usage breakdown
|
||||
- [ ] AC-804.5: Cost optimization recommendations
|
||||
|
||||
---
|
||||
|
||||
## 5. Non-Functional Requirements
|
||||
|
||||
Reference in New Issue
Block a user