Tasks: LSATContentAuthor — Autonomous LSAT Content Generation & Refinement¶
Each task references one or more
FR-*/NFR-*/AC-*IDs from spec.md. All commands run inside Docker per AGENTS.md §"Docker-First Workflow".
Conventions¶
- Status:
[ ]todo /[~]in-progress /[x]done. - Owner:
@copilot.
T-001 — LSATContentAuthor crew + versioned prompt¶
- Refs: FR-1, FR-2, FR-3, NFR-AUDIT-1, NFR-AUDIT-2, NFR-SEC-1, NFR-PERF-1, AC-7
- Owner: @copilot
- Status:
[x] - Files:
backend/law_ai/agents_runtime/crews/lsat_content_author.py(new)backend/law_ai/agents_runtime/prompts/lsat_content_author.v1.md(new)- Steps:
- Define
GenerateQuestionsInput(section, difficulty, count<=10, concepts?, passage_id?),DraftQuestion(mirrorsQuestionschema),GenerateQuestionsOutput(drafts list + trace_id + confidence + model + degraded flag). - Implement
async run(input_data)that loads the prompt file, calls Ollama (format="json"), validates response intoDraftQuestionlist, and falls back to a deterministic placeholder draft when Ollama fails. - Single
provenance.log_agent_call(agent_name="LSATContentAuthor", ..., input_data={"child_trace_ids":[draft.id, ...]})per invocation. - Verify: Unit test
test_lsat_content_author.pymocks Ollama, asserts schema and provenance call.
T-002 — Proposals service (JSONL store + gap analysis)¶
- Refs: FR-4, FR-5, FR-6, FR-8, NFR-HITL-1
- Owner: @copilot
- Status:
[x] - Files:
backend/law_ai/lsat/services/proposals.py(new)backend/var/lsat_proposals/.gitkeep(new)- Steps:
record_proposal(draft, *, agent_trace_id, model, confidence) -> strreturns proposal id; appends JSONL row with status="pending".list_proposals(status, limit)tails the JSONL, returns newest-first with latest-status semantics (replay log).set_status(id, status, *, reviewer, note)appends a status-transition row.promote_to_bank(id)loads the latest draft, writes it into the matching*_bank.json, clearsload_bank.cache_clear(), sets status="approved" withquestion_idfield.gap_analysis(window=5000)tails audit forlsat_gradeevents, aggregates per(section, concept)withattempts >= 3, returns sorted ascending-accuracy list.- Verify:
test_proposals.pyround-trips record→list→approve and asserts bank cache invalidation.
T-003 — REST endpoints under /api/lsat/¶
- Refs: FR-7, FR-12, AC-1, AC-2, AC-3, AC-4
- Owner: @copilot
- Status:
[x] - Files:
backend/law_ai/lsat/urls.py(edit — add 5APIViewclasses + url patterns)backend/tests/lsat/test_proposals_api.py(new)- Steps:
ProposalsView (GET)— list with status filter.ProposalGenerateView (POST)— acceptsGenerateQuestionsInput, callsLSATContentAuthor.run, persists each draft, returns{proposals, trace_id}.ProposalApproveView (POST)— callspromote_to_bank, returns{question_id}.ProposalRejectView (POST)— callsset_status(id, "rejected", note=...).GapsView (GET)— returns gap_analysis output.- All views reuse
RequireLsatpermission. - Verify: API tests run with Django test client; assert all four AC-1..AC-4 paths.
T-004 — Register agent + autonomy dispatcher hook¶
- Refs: FR-9, FR-10, FR-11, AC-5, AC-6
- Owner: @copilot
- Status:
[x] - Files:
backend/law_ai/agents_runtime/registry.py(edit)backend/law_ai/core/tasks.py(edit — add"lsat_content"branch)backend/law_ai/core/management/commands/run_autonomy.py(edit — add choice +_run_lsat_content)backend/law_ai/celery.py(edit —autonomy-lsat-contentbeat entry)- Steps:
register_all_agents()addsLSATContentAuthorwithhuman_approval_required=Trueclass attribute already set.autonomy_cycledispatcheskind="lsat_content"to_run_lsat_content._run_lsat_contentpicks weakest(section, concept)fromgap_analysis()(falls back to LR / med when no learner data), calls the crew withcount=budget, persists every draft aspending.- Beat entry
autonomy-lsat-contentatcrontab(hour=4, minute=0)withkwargs={"kind": "lsat_content", "budget": 5}. - Verify:
curl /api/agents | jq '.agents[] | select(.name=="LSATContentAuthor")'returns the row withhuman_approval_required:true.python manage.py run_autonomy --kind lsat_content --budget 1 --dry-runexits 0.
T-005 — Frontend Authoring tab¶
- Refs: FR-12, AC-8
- Owner: @copilot
- Status:
[x] - Files:
frontend/lib/api.ts(edit — add 5 typed wrappers +LsatProposal/LsatGapinterfaces)frontend/components/LsatLab.tsx(edit — add'authoring'tab +AuthoringPanelcomponent)- Steps:
- Extend
TABSarray with'authoring'. AuthoringPanelfetches/api/lsat/proposals?status=pending+/api/lsat/gapsevery 10s (manual refresh button).- Generate form (section, difficulty, count, concepts) → posts to
/api/lsat/proposals/generate. - Each proposal renders draft preview + Approve / Reject buttons.
- Verify: Smoke test in browser at
/lsat— Authoring tab loads, generate→approve flow works end-to-end against local stack.
T-006 — Backlog + spec gates green¶
- Refs: AC-9
- Owner: @copilot
- Status:
[x] - Files:
BACKLOG.md(edit — appendBL-20260527-*follow-ups under## Claimedfor this spec)- Steps:
- Append BL entries for the follow-ups recorded in plan §6.
- Run
python3 scripts/spec_validator.py && python3 scripts/backlog_lint.py. - Verify: both validators exit 0.
Follow-ups Discovered¶
- BL-20260527-04 — feature, low — Promote
LsatProposalto an ORM model (Postgres) once approval throughput exceeds ~50/week so we can index by reviewer and date. Surfaced in: specs/019-lsat-content-autogen. - BL-20260527-05 — infra, low — Implement JSONL rotation for
backend/var/lsat_proposals/proposals.jsonl(rotate at 50k lines, keep last 25k) mirroringaudit_jsonl. Surfaced in: specs/019-lsat-content-autogen. - BL-20260527-06 — feature, med — Add IRT-style difficulty calibration that adjusts each promoted question's
difficultylabel based on observedlsat_gradeaccuracy after N>=20 attempts. Surfaced in: specs/019-lsat-content-autogen. - BL-20260527-07 — feature, low — Add a "feedback loop" mode where
LSATContentAuthoralso re-drafts existing bank items flagged bygap_analysisas low-accuracy + low-confidence (questions learners consistently miss for stated reasons). Surfaced in: specs/019-lsat-content-autogen. - BL-20260527-08 — doc-gap, low — Add a
LSATContentAuthorrow to docs/agent-roles.md and a brief authoring section to docs/legalbench.md noting that LSAT bank growth is decoupled from LegalBench scoring. Surfaced in: specs/019-lsat-content-autogen.