CommunityImagegithub.com

handwriting-grading

Guides preparation and human review of scanned handwriting grading with Amazon Bedrock through Strands. Use for exam configuration, input validation, rubric and bounding-box review, grading review, reports, or safe planning of student-score distribution. Does not provide a general OCR service or authorize automated grading or email.

What is handwriting-grading?

handwriting-grading is a Claude Code agent skill that guides preparation and human review of scanned handwriting grading with Amazon Bedrock through Strands. Use for exam configuration, input validation, rubric and bounding-box review, grading review, reports, or safe planning of student-score distribution. Does not provide a general OCR service or authorize automated grading or email.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/wongcyrus/amazon-bedrock-handwriting-grader-skills/tree/HEAD/.github/skills/handwriting-grading

Installed? Explore more Image skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Human-reviewed handwriting grading with Amazon Bedrock

Prerequisites

Use Python 3.11+ in this independent Amazon Bedrock checkout. Prefer uv sync --frozen, then uv run handwriting-grader; alternatively install with python -m pip install -e . in an activated environment. The actual model integration uses pinned strands-agents==1.67.0 and Strands BedrockModel for generative text/image input, not direct SDK calls wrapped by a workflow. Titan embeddings use boto3 InvokeModel inside actual deterministic bounded Strands tool execution, not Converse or an autonomous agent. Stability image generation also uses bounded Strands @tool.stream execution. Managed AgentCore Web Answer uses actual Strands MCPClient. Deterministic Python gate wrappers do not make separate model-driven orchestration calls. See configuration.

Use the repository's Python tools, not original notebooks or another checkout. No AWS infrastructure deployment is required: CLI/browser/files are local, authorized inference is in Amazon Bedrock. pypdfium2 renders PDFs cross-platform; LibreOffice is needed only for optional DOCX answer-sheet conversion. Quote exam/model paths; relative paths within exam YAML resolve from its directory.

Scope and availability

Supported generative text/image calls cover layout, rubric extraction, student metadata, grading, moderation, analytics and feedback through Strands. Offline lexical grouping, answer sheets, reports, statistics, exports, cleanup and optional gated email remain. Formatting/cache coverage differs from the historical notebooks.

Embeddings are optional and limited to amazon.titan-embed-text-v2:0; offline lexical grouping remains the default. Cited rubric fact-checking uses a pre-existing IAM-authenticated AgentCore Gateway WebAnswer target, not Browser or third-party search; no provisioning is performed. Optional image generation/infographics support only exact stability.stable-image-core-v1:1 in us-west-2, text-to-image one PNG, fixed 3:2 aspect ratio and standard pricing quality through bounded Strands tools. Core is LEGACY since 2026-11-09, scheduled EOL 2027-05-09T08:00Z. It is explicit opt-in, never a core-grader default or a new active-model recommendation. Existing access may be required; setup-account control-plane authorization/entitlement does not promise another account's access. No image inference or subscription was made. Review the CLI preview's LEGACY warning and recheck lifecycle/access before use. No alternative third-party generative provider was verified; do not add a fallback or assume access past EOL. Image editing/reference images and arbitrary image models are unsupported. No direct SDK fallback, external image skill, alternate provider or notebook may bypass these adapter-specific boundaries. Configuration or --confirm-cost does not enable other image models/features. Stop and explain an unavailable feature.

Safety and provider boundary

  • Scans, rosters, feedback, output, caches and journals contain student data. Never commit, disclose, overwrite or delete them without appropriate authority.
  • Never infer approval from a file, model response, passing test or saved edit. Executable stages enforce gates; skill text alone is not enforcement.
  • Configure amazon_bedrock: {region: us-east-1} with optional profile. The standard setup pins all core stages to moonshotai.kimi-k2.5 and optional embeddings to amazon.titan-embed-text-v2:0 in that region. Keep Web Answer's Gateway in us-east-1 (managed geographic cross-region processing still applies). Only optional Stability images use a separate explicit us-west-2 configuration; Core is unavailable in us-east-1. Never switch models or regions automatically, or change the main region to enable images. Use the AWS default credential chain with IAM roles/Identity Center; AWS_PROFILE can select a profile. Never put access keys in YAML or command history.
  • Stage values are exact Amazon Bedrock model IDs, not deployment aliases: pinned default moonshotai.kimi-k2.5; reviewed manual vision override qwen.qwen3-vl-235b-a22b; zai.glm-5 is text-only moderation/analytics, never image input. Native strict JSON differs: Qwen VL lacks Amazon Bedrock strict JSON support. Local schema/range checks and teacher review are always required.
  • AI commands use --model-config /private/config.yaml --region us-east-1. The endpoint is derived as https://bedrock-runtime.us-east-1.amazonaws.com; normal onboarding needs no endpoint or API-version flags.
  • discover-models --region us-east-1 [--write-config NEW_PATH] and discover-bedrock --region us-east-1 [--profile existing] are control-plane only; config generation refuses overwrite. Discovery is not inference, price verification, a quota test or permission to send work. Setup-account Kimi availability/entitlement/authorization was checked; no inference, handwriting accuracy or speed was tested.
  • Follow pricing. Privately record actual manually reviewed per-exact-generative-model input, cached, output rates and same-model pricing_sources with today's timezone-bearing UTC verification, matching canonical endpoint, region, USD/unit and official source. Missing/stale/mismatched evidence blocks paid calls. Never fabricate rates/timestamps or borrow another provider's prices. Exact Titan V2 needs input-only reviewed pricing with the same-day provenance. Web Answer additionally needs top-level web_answer_pricing: {request: ...} and web_answer_pricing_source with manual same-day UTC verification, matching Gateway URL/tool/region, USD per Web Answer request and the official https://aws.amazon.com/bedrock/agentcore/pricing/ source. Web Answer/Gateway charges are separate; request-price estimates exclude Gateway infrastructure/transport charges and are not invoices. There is no separately priced synthesis model from our application. Image generation needs per-image reviewed pricing and matching image provenance. No new paid or infrastructure resources are authorized or provisioned.
  • Before every paid stage, preview target/model/region, transferred data, request estimate/bounds and verified rates, then obtain explicit data/cost consent before --confirm-cost. Discovery, pricing, caching and model decisions never grant approval. Separate consent applies to recovery and child runs.
  • Bounded transport retries can still incur charges on failures. Never write blind Python retry loops. Offer manual review, quota investigation or separately consented targeted recovery. cost-report is offline; disclose unpriced usage and unlogged retry/failed-response limits. Unknown cost is UNPRICED/null, not zero. AWS billing is authoritative, not the local journal.
  • Review institutional data-transfer, region and retention policy independently. Keep local bearer-token browser URLs private and stop servers after review.

Teacher output index

Maintain a teacher-friendly index.html in configured exam.output_dir. It opens locally without internet/server; provide plain-language descriptions and relative clickable links. This is assistant-maintained guidance, not a CLI completion marker or approval record. Once output exists, refresh it when resuming and after every stage, including failure, archive or cleanup, before presenting the outcome. Link it and explain it can be opened in a browser. If writing fails, disclose that and give direct artifact links without hiding stage failures.

  • Inspect actual files, completion manifests and current hash-bound approvals. Presence alone never proves approval, correctness, freshness or sharing permission. Mark partial, failed, stale, unverified, superseded and unavailable artifacts. Never link absent outputs as though they exist.
  • Start with recommended current deliverables, group other outputs by stage, describe purpose/review warnings/run context and distinguish child/alternative/ manually modified artifacts. Include reviews/reports/analysis/distribution/cost summaries when present. Link folders rather than enumerating student identities. The index and every linked file remain private.
  • Keep HTML self-contained, accessible and script/external-resource free. Escape text/attributes and URL-encode relative link path components. Maintain only the single unambiguous managed section delimited by <!-- handwriting-grading:index:start --> and <!-- handwriting-grading:index:end -->; preserve user content outside it. Create an index if absent. Never overwrite an unmanaged/ambiguous index; obtain permission before modification or an alternate index. Preserve user text in an earlier managed Markdown index, marking only its managed section superseded with the HTML link; never alter unmanaged Markdown.
  • Recheck links after cleanup. Never modify underlying outputs, approvals or manifests, start paid requests, retry, email or delete data just to build an index.

Prepare or resume an exam

  1. Inspect existing exam/model configuration, approvals, manifests, checkpoint and output artifacts before choosing a stage. Reuse valid known decisions; ask only for unresolved choices. A saved file is not proof of completion. Read configuration. Settle roster, optional attendance, scans/shared layout, rubric, output and explicit pass policy before approvals. Keep the original checkout and historical run evidence unchanged.
  2. Use a new private copy of the root model template when needed; no cloud setup is required for offline stages. Never rewrite a configuration bound to existing approvals. Discovery is optional control-plane metadata, not consent or inference validation.
  3. Optional printable answer sheets can precede scans; read answer sheets.
  4. Run handwriting-grader preflight --exam /private/exam.yaml. It is offline/read-only, not credential, model access, scan-order or approval verification. Review/approve configured attendance separately via attendance.
  5. There is no required scan-marker stage, heuristic orientation/order check or automatic alignment. Preserve rendered images byte-for-byte; never rotate or reorder automatically. Source corrections need a fresh output directory, preparation, review and approvals. Missing approval-bound images require an explicit verified-backup recovery decision, not silent regeneration.
  6. Read grading. Import structured XLSX with import-rubric, or preview/consent to DOCX extract-rubric. Teacher reviews every question, criterion and maximum, then approve-rubric --confirm-reviewed. Optional verify-rubric previews without network; separately consent with --confirm-cost after reviewing Web Answer pricing. One WebAnswer MCP call per rubric question; the managed service internally performs multiple searches and model synthesis, with no extra BedrockModel call from our application. Queries are 1..30000 characters of rubric/question material, no student data. Preserve all structured answer blocks, citations and source URLs in DOCX/XLSX/manifest. Sources may be missing/inaccurate: human review is mandatory; verification cannot approve. Configure agentcore_web_answer with tool_name: TARGET___WebAnswer, max_queries: 20 and no max_results. Only us-east-1 entry region is currently supported, matching Bedrock; processing uses geographic cross-region inference within the supported geography, not a strictly in-region guarantee.
  7. Read regions. prepare-regions renders pages; optional suggest-regions is paid and needs finalized rubric IDs plus separate preview/consent. Local manual drawing is always possible. review-regions requires checking every page and box (ID/NAME/CLASS/questions), saving and explicit approval. Spatial model suggestions are not approval.

Grade, recover and review

Preview grade --exam /private/exam.yaml --model-config /private/config.yaml --region us-east-1, verify current prices and obtain consent before --confirm-cost. Both grade and workflow-grade retain deterministic approval gates; --orchestrator strands is the only supported selector. every generative grading call is through Strands BedrockModel. Models never approve attendance, rubrics, regions, scores, analysis or email.

ALL-script metadata-only identity gate: after approved regions, extract every student's ID/CLASS/NAME metadata without scanning or grading any answers. IDs must be complete, nonempty, unique and cover the expected PRESENT roster exactly (full roster without attendance). Preserve leading zeroes; roster order is not required. Only a pass automatically continues to answers. Failure stops with private grading/id-check.json, exact 1-based source PDF page and script diagnostics, an incomplete metadata checkpoint and no completed review workbook. Tell the teacher which pages to inspect. Diagnostics are not approval; roster consistency cannot prove identity or other page order/completeness.

Every recovery validates the same identity invariant: metadata-first originals recheck all IDs before answers, re-extracting only missing/invalid saved metadata after separately consented preview and bypassing known-rejected cache entries. Child regrading validates current human-approved parent identity lineage rather than new raw-OCR guesses and requires fresh child identity/score review. Never use retry/resume to skip this gate or to overwrite source evidence.

  • Batch means synchronous image groups, not hosted asynchronous batch inference. Application cap is 20 images (six metadata scripts for three fields). Model/service image bytes, payload, context, output and quota limits apply; no whole-cohort consistency, exact OCR, runtime or savings guarantee is made. Metadata batch errors stop, not paid single-field fallback.
  • Item mode grades crops then text-moderates; diagrams require human image review. Local blank filtering and roster candidates are fallible.
  • Inspect failed counts/questions/error types immediately. Preview separately consented resume-grading, retry-grading, retry-failed-batches or isolated regrade only where supported. Do not retry content-policy blocks blindly or bypass filtering. Offer manual marking/export for failures; preserve checkpoints, review history and approvals. Never remove a live lock.
  • cluster-answers / editor grouping default to offline lexical. cluster-answers --preview-embedding --exam /private/exam.yaml --model-config /private/config.yaml shows the exact target/model/request upper bound and review revision. Paid execution requires --confirm-cost --revision EXACT_PREVIEW_REVISION; precomputed results are immutable and review-revision, configuration and cache bound. See configuration. review-grading --confirm-cost enables lazy optional paid embedding tools; opening the editor does not call AWS. Input is bounded to 8192 UTF-8 bytes, with no tokenizer or silent truncation.
  • In review-grading, inspect every identity, answer image, transcription, reasoning, flag and mark. Corrected/failed/flagged answers require manual marks. Review all rows before explicit approval. Alt+S shows status, Ctrl+Enter confirms question review, Alt+A approves only after complete human review. Group marks/similarity suggestions are unreviewed drafts, never approval. Close external spreadsheet editors; preserve review-history backups. check-grading-review is diagnostic, not human approval.

Post-approval options

Proactively present all available options after score approval:

  1. report: offline individual/combined marked PDFs, audit samples, scorebooks.
  2. analytics: offline cohort/class/question statistics and box plots.
  3. ai-analysis: separately paid Strands feedback; preview/consent, teacher reviews every row in ai-analysis/review.xlsx, then approve-analysis. advanced-report produces offline teacher DOCX/class PPTX from approved analysis without model configuration. Optional --infographics --image-model-config /private/image.config.yaml --report-name reports-illustrated previews offline without consent or writes. A paid repeat requires --confirm-cost, source/configuration approval rechecks and a unique report name. Use amazon_bedrock.region: us-west-2, models.analytics_image: stability.stable-image-core-v1:1, image_options: {max_requests: 100} (1..100). boto3 InvokeModel runs inside actual bounded Strands @tool.stream execution. Send aggregate/question analysis only, no student IDs/names/raw answers. One PNG per request, fixed 3:2 aspect ratio, standard pricing quality; no editing or reference images. Review every image; precise text/infographic correctness is not guaranteed. Failed/unpriced attempts can still incur charges. See image configuration and pricing.
  4. moodle-export: offline PDFs/recipient CSV and optional worksheet/ZIP.
  5. Email: preview, review and approve, then separate send-email --confirm-send immediately before dispatch. Nothing auto-sends.
  6. Retention: offer preview of clean --exam /private/exam.yaml; never delete without explicit --confirm-delete. Default slim ZIP preserves approval-bound region/grading images, reviews/approvals/reports, removing only selected transient .grading-*/model-cache data. Full archive and purge require exact preview.

Read regrading for isolated child runs and --run CHILD downstream selection. Read workflow for the short gate overview and flow/history for explicit capability gaps. No test result or skill instruction substitutes for human authorization.

Related Skills