Proposed solution: Agentic rewriter

Keep a history of the teacher's actions. Send it to the LLM with the grading task and feedback on each rewrite. The model adapts the wording to the teacher's style without changing the meaning or scores.

Teacher-written text matters more than AI-generated text. Newer examples and instructions take priority when preferences change.

What goes into the history

Illustrative UI examples.

Feedback written by the teacher

When the teacher saves their own feedback, record it with the assignment, rubric, and student submission.

AI feedback edited by the teacher

Record the original AI feedback and the teacher's saved version, not every keystroke.

Writing instructions changed Optional

Add a freeform "Writing style" setting. Record each saved change in the history.

Rewrite requested by the teacher Optional

Let the teacher ask for a change in plain language. Record the request, the suggested edit, and whether they accepted, rejected, or modified it.

Context compaction

When the history reaches a limit, for example 100 messages, summarize the older events and keep the latest 50 unchanged. Keep the system prompt fixed.

Costs

Roughly $0.04 per edit for history input.

Based on the earlier estimate of 2,000 tokens per event, cached history, and compaction from 100 to 50 messages. Current task input, output tokens, and summarization cost extra.

Implementation

Frontend

  • Add the optional writing instructions and rewrite request controls.
  • Send saved feedback, edits, instruction changes, and edit decisions to the backend.

Backend

  • Store a history for each teacher and append events received from the frontend.
  • Send the history, grading context, and feedback to ML when a rewrite is requested.

ML

  • Add an endpoint that rewrites feedback using the teacher's history.
  • Summarize older events when the context reaches its limit.

Libraries

No additional libraries are required. Reuse the existing storage and LLM connector. No RAG, vector database, or agent framework is needed.