Skip to content

Migrate semantic interpreter to task_complexity_scale (INTENT §4 v3 compliance) #135

@CoreyRDean

Description

@CoreyRDean

Background

INTENT.md §4 (architectural properties, v2) added "Cost transparency": every Claude session clauck spawns derives sizing from a single shared formula in lib/sizing.py keyed on a task_complexity_scale float. The scope statement named the semantic interpreter as a known compliance gap that must be closed before the v3 contract amendment:

Scope of compliance at v2 adoption: doctor, scheduler, CLI surfaces (clauck size, clauck validate, clauck inspect), and all marketplace jobs are fully compliant. The natural-language semantic interpreter (clauck <anything>, clauck work <text>) still emits its own stage-2 execution params directly — a known compliance gap tracked for follow-up.

What's non-compliant

_build_interpreter_prompt in lib/clauck (search: def _build_interpreter_prompt) instructs the classifier to emit:

{
  "command_type": "semantic",
  "interpretation": "...",
  "enhanced_prompt": "...",
  "exec_model": "haiku|sonnet|opus",
  "exec_effort": "low|medium|high",
  "exec_max_turns": <int>,
  "exec_max_budget_usd": <float>
}

The last four fields are exactly the literal-anchoring failure mode that drove PR #101 for doctor: classifiers under load grab literal dollar values from the prompt instead of computing, producing the $0.25 budget-exceeded cluster that broke doctor in practice. Every clauck <anything> invocation rides that same risk today.

The docstring at _build_interpreter_prompt acknowledges the gap with a pointer at INTENT.md §4, but that doesn't close it.

What the fix looks like (follows the doctor migration pattern from PR #101)

  1. Classifier output shrinks to scale-only: emit {command_type, interpretation, enhanced_prompt, task_complexity_scale} — drop the four exec fields entirely.
  2. cmd_semantic computes params via sizing.compute_sizing using the emitted scale, same way cmd_doctor does today.
  3. Update the prompt's "Sizing the semantic execution" section with scale anchors matching the job-creation guidance already in that file (0.10 trivial / 0.25 focused / 0.40 multi-source / 0.55 investigation / 0.75 DAG / 0.95 architectural).
  4. Keep the job-creation guidance as-is — it already correctly directs Claude to emit complexity: in new job frontmatter, not raw params.

Doctor's migration is the reference: see _build_doctor_interpreter_prompt + the cmd_doctor routing block around the sizing.compute_sizing call.

Why this is tracked vs. just done in PR #128

PR #128's scope was "make the plugin the canonical install path." The semantic-interpreter migration is its own refactor with its own review surface — crosses the cmd_semantic execution path, changes the routing JSON schema, and touches the only remaining consumer of the scale-less flow. Bundling would have ballooned that PR; tracking as follow-up was the right call.

Acceptance

  • _build_interpreter_prompt emits task_complexity_scale only for the semantic branch; no model/effort/turns/budget fields.
  • cmd_semantic derives all four params via sizing.compute_sizing (including MCP auto-promote for non-strict_mcp_config runs).
  • Invocation smoke test: a trivial clauck "list my jobs" stays cheap; a clauck "audit every job for cost overruns" routes to sonnet/high with a budget the formula produces, not a classifier-guessed literal.
  • Update INTENT.md §4 scope statement: remove the "known compliance gap" carveout once landed.
  • Optional: amend INTENT.md version to v3 when the last scope-statement compliance gap closes.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions