Remove unused Artifact and CodeDiff systems. Enhance AgentMemory to be the primary knowledge store. Encourage agents to store learnings during work.
## Research Context
Deep analysis revealed:
- **Artifacts**: 0 records, unused - redundant with Comments
- **CodeDiffs**: 0 records, GitHub PR handles code review
- **Comments**: 6 records, actively used for communication
- **AgentMemory**: 1 record, underutilized but valuable for RAG
## Changes Required
### 1. Remove Unused Systems
**Models to delete:**
- `app/models/artifact.rb`
- `app/models/code_diff.rb`
**Controllers to delete:**
- `app/controllers/api/v1/artifacts_controller.rb`
- `app/controllers/api/v1/code_diffs_controller.rb`
**Specs to delete:**
- `spec/controllers/api/v1/artifacts_controller_spec.rb`
- `spec/controllers/api/v1/code_diffs_controller_spec.rb`
**Routes to remove:**
```ruby
resources :artifacts, only: [:create]
resources :code_diffs, only: [:index, :show, :create]
```
**MCP tools to remove:**
- `checkpoint_task` from `mcp-bridge/src/tools/index.ts`
- `create_code_diff` from `mcp-bridge/src/tools/index.ts`
**Database:**
- No migration needed (0 records in both tables)
- Tables can be dropped in future migration if desired
### 2. Enhance AgentMemory
**Add new memory type:**
```ruby
# app/models/agent_memory.rb
VALID_TYPES = %w[
decision
error
instruction
code_snippet
fact
summary # NEW: conversation summaries, research findings
]
```
**Update MCP tool description:**
```typescript
// mcp-bridge/src/tools/index.ts
{
name: "store_memory",
description: "Store knowledge for future retrieval. Use this when:
- You solve a problem that might occur again (type: error)
- You make a decision other agents should know about (type: decision)
- You learn something about the codebase/system (type: fact)
- You complete research that should be preserved (type: summary)
- You encounter an error and find a solution (type: error)
- You discover a reusable pattern (type: instruction)"
}
```
### 3. Agent Behavior Guidance
**Orchestrator should prompt Workers to store memories:**
- After solving bugs → store `error` memory with solution
- After making architectural choices → store `decision` memory
- After completing research → store `summary` memory
- When discovering system facts → store `fact` memory
## Final Architecture
```
KEEP:
├── Comment (4 types: note, decision, question, code_review)
├── AgentMemory (6 types: decision, error, instruction, code_snippet, fact, summary)
└── AgentLog (audit trail)
REMOVE:
├── Artifact (redundant with Comments)
└── CodeDiff (GitHub PR handles this)
```
## Data Growth Projection (100 tickets/day)
- Comments: ~45 MB/month
- Memories: ~7.5 MB/month
- AgentLogs: ~30 MB/month
- Total: ~82.5 MB/month (~1 GB/year)
Remove unused Artifact and CodeDiff systems. Enhance AgentMemory to be the primary knowledge store. Encourage agents to store learnings during work.
## Research Context
Deep analysis revealed:
- **Artifacts**: 0 records, unused - redundant with Comments
- **CodeDiffs**: 0 records, GitHub PR handles code review
- **Comments**: 6 records, actively used for communication
- **AgentMemory**: 1 record, underutilized but valuable for RAG
## Changes Required
### 1. Remove Unused Systems
**Models to delete:**
- `app/models/artifact.rb`
- `app/models/code_diff.rb`
**Controllers to delete:**
- `app/controllers/api/v1/artifacts_controller.rb`
- `app/controllers/api/v1/code_diffs_controller.rb`
**Specs to delete:**
- `spec/controllers/api/v1/artifacts_controller_spec.rb`
- `spec/controllers/api/v1/code_diffs_controller_spec.rb`
**Routes to remove:**
```ruby
resources :artifacts, only: [:create]
resources :code_diffs, only: [:index, :show, :create]
```
**MCP tools to remove:**
- `checkpoint_task` from `mcp-bridge/src/tools/index.ts`
- `create_code_diff` from `mcp-bridge/src/tools/index.ts`
**Database:**
- No migration needed (0 records in both tables)
- Tables can be dropped in future migration if desired
### 2. Enhance AgentMemory
**Add new memory type:**
```ruby
# app/models/agent_memory.rb
VALID_TYPES = %w[
decision
error
instruction
code_snippet
fact
summary # NEW: conversation summaries, research findings
]
```
**Update MCP tool description:**
```typescript
// mcp-bridge/src/tools/index.ts
{
name: "store_memory",
description: "Store knowledge for future retrieval. Use this when:
- You solve a problem that might occur again (type: error)
- You make a decision other agents should know about (type: decision)
- You learn something about the codebase/system (type: fact)
- You complete research that should be preserved (type: summary)
- You encounter an error and find a solution (type: error)
- You discover a reusable pattern (type: instruction)"
}
```
### 3. Agent Behavior Guidance
**Orchestrator should prompt Workers to store memories:**
- After solving bugs → store `error` memory with solution
- After making architectural choices → store `decision` memory
- After completing research → store `summary` memory
- When discovering system facts → store `fact` memory
## Final Architecture
```
KEEP:
├── Comment (4 types: note, decision, question, code_review)
├── AgentMemory (6 types: decision, error, instruction, code_snippet, fact, summary)
└── AgentLog (audit trail)
REMOVE:
├── Artifact (redundant with Comments)
└── CodeDiff (GitHub PR handles this)
```
## Data Growth Projection (100 tickets/day)
- Comments: ~45 MB/month
- Memories: ~7.5 MB/month
- AgentLogs: ~30 MB/month
- Total: ~82.5 MB/month (~1 GB/year)