After each task execution, agent records its decision, reasoning, and outcome to memory service. Before each task, agent queries past decisions for context.
# Start local Temporal + memory serviceTEMPORAL_HOSTPORT=localhost:7233 \
MEMORY_SERVICE_URL=http://localhost:8080 \
go run cmd/worker/main.go &# Trigger learning workflow
go run cmd/starter/main.go --workflow AgentLearningWorkflow \
--input {"tool":"kubectl","task":"debug-pod","context":"CrashLoopBackOff"}# Verify in memory service:
curl http://localhost:8080/memory/query -d {"query":"agent_decision kubectl","project":"poimen"}# Should return the recorded decision
// workflow/agent_learning_test.gofuncTestAgentLearningWorkflow_RecordsDecision(t*testing.T){// Mock QueryPastDecisions returns empty (first time)// Mock task execution succeeds// Assert RecordDecision called with tool=kubectl// Assert RecordOutcome called with success=true}funcTestAgentLearningWorkflow_UsesContext(t*testing.T){// Mock QueryPastDecisions returns 2 past decisions// Assert past decisions passed to task execution}
Effort
~300 LOC, 3 days
## Goal
After each task execution, agent records its decision, reasoning, and outcome to memory service. Before each task, agent queries past decisions for context.
## Depends On
- Memory service: agent entity endpoints (poimen-memory Phase 3.2-3.4)
- This repo: synthesis activities registered (#14)
## Workflow: AgentLearningWorkflow
```
Input: { tool, task, context }
1. QueryPastDecisions — GET /memory/query?entity_type=agent_decision&tool=X
2. ExecuteTask — run actual task workflow (orchestrator/routing)
3. RecordDecision — POST /memory/ingest (entity_type=agent_decision)
4. RecordOutcome — PATCH decision with success/failure/quality
5. UpdatePromptStats — if LLM was used, update prompt usage stats
6. UpdateSkillStats — if skill was invoked, update success rate
```
## Activities
1. `QueryPastDecisionsActivity` — call memory service, filter by tool+entity_type
2. `RecordDecisionActivity` — ingest agent_decision entity with reasoning
3. `RecordOutcomeActivity` — update decision with outcome
4. `UpdatePromptStatsActivity` — increment prompt usage_count + avg_quality
5. `UpdateSkillStatsActivity` — increment skill invocation_count + success_rate
## Acceptance Test
```bash
# Start local Temporal + memory service
TEMPORAL_HOSTPORT=localhost:7233 \
MEMORY_SERVICE_URL=http://localhost:8080 \
go run cmd/worker/main.go &
# Trigger learning workflow
go run cmd/starter/main.go --workflow AgentLearningWorkflow \
--input {"tool":"kubectl","task":"debug-pod","context":"CrashLoopBackOff"}
# Verify in memory service:
curl http://localhost:8080/memory/query -d {"query":"agent_decision kubectl","project":"poimen"}
# Should return the recorded decision
```
```go
// workflow/agent_learning_test.go
func TestAgentLearningWorkflow_RecordsDecision(t *testing.T) {
// Mock QueryPastDecisions returns empty (first time)
// Mock task execution succeeds
// Assert RecordDecision called with tool=kubectl
// Assert RecordOutcome called with success=true
}
func TestAgentLearningWorkflow_UsesContext(t *testing.T) {
// Mock QueryPastDecisions returns 2 past decisions
// Assert past decisions passed to task execution
}
```
## Effort
~300 LOC, 3 days
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Goal
After each task execution, agent records its decision, reasoning, and outcome to memory service. Before each task, agent queries past decisions for context.
Depends On
Workflow: AgentLearningWorkflow
Activities
QueryPastDecisionsActivity— call memory service, filter by tool+entity_typeRecordDecisionActivity— ingest agent_decision entity with reasoningRecordOutcomeActivity— update decision with outcomeUpdatePromptStatsActivity— increment prompt usage_count + avg_qualityUpdateSkillStatsActivity— increment skill invocation_count + success_rateAcceptance Test
Effort
~300 LOC, 3 days