feat: add learner memory ingestion
This commit is contained in:
79
.planning/phases/003-learner-memory/003-CONTEXT.md
Normal file
79
.planning/phases/003-learner-memory/003-CONTEXT.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# Phase 3: Learner Memory - Context
|
||||
|
||||
**Gathered:** 2026-04-26
|
||||
**Status:** Ready for planning
|
||||
**Source:** GSD continuation after Phase 2 completion
|
||||
|
||||
<domain>
|
||||
## Phase Boundary
|
||||
|
||||
Phase 3 converts graded answer evidence into structured learner memory. It
|
||||
should build the memory boundary needed by later progression work while keeping
|
||||
storage in-memory for now.
|
||||
|
||||
</domain>
|
||||
|
||||
<decisions>
|
||||
## Implementation Decisions
|
||||
|
||||
### Persistence
|
||||
|
||||
- Use in-memory learner memory storage in Phase 3.
|
||||
- Do not introduce a database until the product loop needs durability across
|
||||
restarts.
|
||||
- Preserve a clear store interface so persistent storage can replace it later.
|
||||
|
||||
### Memory Model
|
||||
|
||||
- Store learner profile.
|
||||
- Store concept mastery with evidence.
|
||||
- Store misconception records linked to answer evidence.
|
||||
- Store intervention history and review schedule placeholders.
|
||||
- Do not promote temporary session context unless workflow output includes
|
||||
evidence.
|
||||
|
||||
### Integration
|
||||
|
||||
- Diagnostic answer submission should invoke memory extraction after typed
|
||||
grading.
|
||||
- The workflow runner should emit `MemoryUpdateCandidate` values.
|
||||
- Memory service should apply only updates with evidence.
|
||||
|
||||
</decisions>
|
||||
|
||||
<canonical_refs>
|
||||
## Canonical References
|
||||
|
||||
- `docs/planning/PRD.md` - learner memory product goals.
|
||||
- `docs/planning/ARCHITECTURE.md` - memory strategy.
|
||||
- `docs/planning/WORKFLOW_CONTRACTS.md` - memory update contract.
|
||||
- `.planning/REQUIREMENTS.md` - MEM-01 through MEM-05.
|
||||
- `.planning/ROADMAP.md` - Phase 3 success criteria.
|
||||
- `openspec/changes/bootstrap-job-tutor-platform/specs/learner-memory/spec.md`
|
||||
- learner memory requirements.
|
||||
|
||||
</canonical_refs>
|
||||
|
||||
<specifics>
|
||||
## Specific Ideas
|
||||
|
||||
- Add `internal/learnermemory`.
|
||||
- Add `GET /api/v1/learners/{userID}/memory`.
|
||||
- Wire diagnostic answer submission to memory ingestion.
|
||||
- Keep memory extraction deterministic in the workflow stub.
|
||||
|
||||
</specifics>
|
||||
|
||||
<deferred>
|
||||
## Deferred Ideas
|
||||
|
||||
- Database persistence.
|
||||
- Cross-session ranking/decay.
|
||||
- UI readiness map.
|
||||
- Spaced repetition scheduling details.
|
||||
|
||||
</deferred>
|
||||
|
||||
---
|
||||
*Phase: 003-learner-memory*
|
||||
*Context gathered: 2026-04-26*
|
||||
58
.planning/phases/003-learner-memory/003-PLAN.md
Normal file
58
.planning/phases/003-learner-memory/003-PLAN.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Phase 3 Plan: Learner Memory
|
||||
|
||||
**Status:** Ready for execution
|
||||
**Phase Goal:** Convert graded answer evidence into structured learner memory.
|
||||
|
||||
## Requirements Covered
|
||||
|
||||
- MEM-01: System stores learner profile with role, stack, timeline, and
|
||||
preferences.
|
||||
- MEM-02: System stores concept mastery states with evidence.
|
||||
- MEM-03: System stores recurring misconceptions with supporting answers.
|
||||
- MEM-04: System stores intervention history and review schedule.
|
||||
- MEM-05: Temporary session context does not become durable memory without
|
||||
evidence.
|
||||
|
||||
## Tasks
|
||||
|
||||
### 1. Add learner memory package
|
||||
|
||||
- Create `internal/learnermemory`.
|
||||
- Define profile, concept mastery, misconception, intervention, review schedule,
|
||||
and snapshot types.
|
||||
- Add in-memory store with clear interface.
|
||||
|
||||
### 2. Add memory extraction workflow output
|
||||
|
||||
- Extend `workflows.StubRunner.ExtractLearningMemory` to return evidenced
|
||||
memory update candidates from a graded answer.
|
||||
- Ensure candidates without evidence are not applied.
|
||||
|
||||
### 3. Wire diagnostic answers to memory
|
||||
|
||||
- Inject learner memory service into interview service.
|
||||
- After grading an answer, extract and apply memory updates.
|
||||
- Keep diagnostic session records and learner memory records separate.
|
||||
|
||||
### 4. Add memory read endpoint
|
||||
|
||||
- Add `GET /api/v1/learners/{userID}/memory`.
|
||||
- Return learner profile, mastery, misconceptions, interventions, and review
|
||||
schedule.
|
||||
|
||||
### 5. Add tests and verification
|
||||
|
||||
- Test memory applies only evidenced updates.
|
||||
- Test diagnostic answer submission updates learner memory.
|
||||
- Test memory HTTP read endpoint.
|
||||
- Run Go tests, OpenSpec validation, and line-count check.
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- Persistent database.
|
||||
- Memory ranking/decay.
|
||||
- Progression readiness map.
|
||||
- Frontend UI.
|
||||
|
||||
---
|
||||
*Plan created: 2026-04-26*
|
||||
33
.planning/phases/003-learner-memory/003-RESEARCH.md
Normal file
33
.planning/phases/003-learner-memory/003-RESEARCH.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Phase 3 Research
|
||||
|
||||
## Question
|
||||
|
||||
How should learner memory be added without turning the diagnostic session store
|
||||
into durable product truth?
|
||||
|
||||
## Findings
|
||||
|
||||
### Keep memory separate from interview sessions
|
||||
|
||||
Diagnostic sessions contain raw interaction records. Learner memory should be a
|
||||
separate derived state built from graded evidence. This preserves the boundary
|
||||
between temporary/session context and durable learning claims.
|
||||
|
||||
### Apply only evidenced updates
|
||||
|
||||
The memory service should ignore update candidates that do not include evidence.
|
||||
This directly enforces the OpenSpec rule that inferred memory requires evidence.
|
||||
|
||||
### In-memory is still enough
|
||||
|
||||
The current product does not yet need restart durability. A store interface plus
|
||||
tests gives the shape of persistence without adding database complexity early.
|
||||
|
||||
## Recommendation
|
||||
|
||||
1. Add `internal/learnermemory` with profile, mastery, misconception,
|
||||
intervention, and review schedule records.
|
||||
2. Extend workflow runner memory extraction to return evidenced candidates.
|
||||
3. Wire diagnostic answer submission to memory ingestion.
|
||||
4. Add HTTP read endpoint for learner memory snapshot.
|
||||
5. Verify with tests and live smoke.
|
||||
36
.planning/phases/003-learner-memory/003-SUMMARY.md
Normal file
36
.planning/phases/003-learner-memory/003-SUMMARY.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Phase 3 Summary
|
||||
|
||||
**Status:** Complete
|
||||
**Completed:** 2026-04-26
|
||||
|
||||
## Delivered
|
||||
|
||||
- Added `internal/learnermemory` for profile, concept mastery,
|
||||
misconceptions, interventions, review schedule, and snapshots.
|
||||
- Added in-memory learner memory store and service.
|
||||
- Extended `GradedAnswer` with `user_id`.
|
||||
- Implemented `ExtractLearningMemory` in the workflow stub.
|
||||
- Wired diagnostic answer submission to memory extraction and evidence-backed
|
||||
memory application.
|
||||
- Added `GET /api/v1/learners/{userID}/memory`.
|
||||
- Added unit and HTTP tests for memory application and readback.
|
||||
|
||||
## Verification
|
||||
|
||||
```powershell
|
||||
gofmt -w cmd internal
|
||||
go test ./...
|
||||
openspec validate bootstrap-job-tutor-platform --strict
|
||||
```
|
||||
|
||||
Additional smoke check:
|
||||
|
||||
- Diagnostic create/answer followed by learner memory read returned 1 mastery
|
||||
entry for `user-1`.
|
||||
|
||||
## Deferred
|
||||
|
||||
- Durable database persistence.
|
||||
- Memory decay and ranking.
|
||||
- Repeated-mistake clustering beyond the current evidenced candidate writes.
|
||||
- Progression readiness map UI/API.
|
||||
27
.planning/phases/003-learner-memory/003-VERIFICATION.md
Normal file
27
.planning/phases/003-learner-memory/003-VERIFICATION.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Phase 3 Verification
|
||||
|
||||
## Verdict
|
||||
|
||||
PASS
|
||||
|
||||
## Requirement Coverage
|
||||
|
||||
- MEM-01: PASS. Diagnostic session creation ensures a learner profile with
|
||||
target role, stack, and timeline.
|
||||
- MEM-02: PASS. Graded answer evidence creates concept mastery entries.
|
||||
- MEM-03: PASS. Weak or partial answers create evidenced misconception entries.
|
||||
- MEM-04: PASS. Weak or partial answers create intervention history and review
|
||||
schedule entries.
|
||||
- MEM-05: PASS. Memory service ignores update candidates without evidence.
|
||||
|
||||
## Evidence
|
||||
|
||||
- `go test ./...` passed.
|
||||
- `openspec validate bootstrap-job-tutor-platform --strict` passed.
|
||||
- Live diagnostic create/answer plus learner memory read smoke passed.
|
||||
- Go source line-count check passed.
|
||||
|
||||
## Residual Risk
|
||||
|
||||
Learner memory is intentionally in-memory for the MVP proof. Data is lost on
|
||||
process restart until a persistence phase is planned.
|
||||
Reference in New Issue
Block a user