# Generated by WTF-P adapter compiler v5 from clio/clio-coder-extension.yaml; do not edit.
id: wtfp
plugin: wtfp
name: WTF-P
version: 0.8.4
description: "The WTF-P writing desk for Clio Coder; paper state, gates and the write guard run in code."
compatibility: { clio: ">=0.6.3" }
runtime:
  api: 2
  entrypoint: runtime/extension.ts
  commands:
    - { name: desk, description: "Enter the WTF-P writing desk." }
    - { name: progress, description: "Paper progress and the next action, computed locally.", replaces: prompt }
    - { name: help, description: "The WTF-P action reference, rendered locally.", replaces: prompt }
    - { name: check-todos, description: "Answer pending gates and author tasks.", replaces: prompt }
    - { name: checkpoints, description: "List interaction gates and state snapshots." }
    - { name: validate, description: "Validate every planning record against its schema." }
  events: [session_open, turn_end, dispatch_started, dispatch_completed, dispatch_failed, fs_changed, workspace_enter, workspace_leave]
  watch: [".planning/**", "paper/**"]
  hooks:
    - { on: prompt_submit, timeoutMs: 1000, onTimeout: pass, onError: pass }
    - { on: turn_start, timeoutMs: 1000, onTimeout: pass, onError: pass }
    - { on: before_tool, tools: [write, edit, artifact, dispatch, bash, run_script, job, ask_user], timeoutMs: 1500, onTimeout: block, onError: block }
    - { on: after_tool, tools: [write, edit], timeoutMs: 1000, onTimeout: pass, onError: pass }
  tools:
    - name: record
      description: "Write .planning records at their logical URIs: each validated against its canonical schema, checked against the version you read (expect_revision for state, outline and decisions; expect_sha256 for the rest; neither when creating), its revision bumped, and committed under the project lock. Pass several as writes to commit them together. Refuses author resolutions and anything the running action does not declare."
      actionClass: execute
      inputSchema:
        type: object
        properties:
          uri: { type: string }
          record: { type: object }
          expect_revision: { type: integer }
          expect_sha256: { type: string }
          writes:
            type: array
            maxItems: 16
            items:
              type: object
              properties: { uri: { type: string }, record: { type: object }, expect_revision: { type: integer }, expect_sha256: { type: string } }
              required: [uri, record]
              additionalProperties: false
        additionalProperties: true
    - name: status
      description: "The whole project in one read: phase, every section's status, words, plan state, unsupported claims and blockers, open gates, evidence counts, record issues, and the next step by the progress ladder. Call it first instead of reading records to orient; then read only the records you will change or quote."
      actionClass: execute
      inputSchema: { type: object, properties: {}, additionalProperties: false }
    - name: read_record
      description: "Read one .planning record at its logical URI with the revision and sha256 to pass back to record, and, for a checkpoint, whether the author's answer is attested by the desk. A family URI (project://sections, project://sources, project://evidence, project://checkpoints, project://validations, project://interactions) returns all its records in one call."
      actionClass: execute
      inputSchema: { type: object, properties: { uri: { type: string } }, required: [uri], additionalProperties: false }
    - name: readiness
      description: "Whether a section's manuscript may be drafted now: its blocking gates, whether the author approved exactly its current plan, and structural evidence coverage of its required claims."
      actionClass: execute
      inputSchema: { type: object, properties: { section: { type: string } }, required: [section], additionalProperties: false }
    - name: measure_section
      description: "Count a section's manuscript body words by the desk's one method and record the count in the section and state records, committed together."
      actionClass: execute
      inputSchema: { type: object, properties: { section: { type: string } }, required: [section], additionalProperties: false }
    - name: archive
      description: "Inside an action that declares a milestone archive: copy every .planning record and artifact and every paper/ file into .planning/archives/<archive>/ with a sha256 manifest. An archive is immutable; an existing id is refused."
      actionClass: execute
      inputSchema: { type: object, properties: { archive: { type: string } }, required: [archive], additionalProperties: false }
    - name: next_step
      description: "Only inside a /wtfp:advance turn: the desk picks the next step from the project by the progress ladder and arms the write guard for that action and section alone. Returns a step to run, a gate to put to the author with gate, or the reason the run stops."
      actionClass: execute
      inputSchema: { type: object, properties: { after: { type: string, description: "The step you just finished, such as \"plan-section introduction\", or \"start\"; Clio's loop guard reads repeated identical calls as a loop." } }, additionalProperties: false }
    - name: gate
      description: "Ask the author a pending checkpoint, or confirm a recorded answer the desk never saw, as an interview; only the author's answer resolves it, and the desk seals what was asked and answered."
      actionClass: execute
      inputSchema: { type: object, properties: { checkpoint: { type: string } }, required: [checkpoint], additionalProperties: false }
  ui: [status, band, card, toast, interview]
  workspaces:
    - id: desk
      title: WTF-P writing desk
      regions: [header, board, islands, rail, footer]
      board: band
      skin: skins/wtfp.json
      keys:
        - { key: f, action: next, label: "Fill the next writing action" }
        - { key: a, action: advance, label: "Advance to the next gate only you can answer" }
        - { key: c, action: gates, label: "Answer the pending gate" }
        - { key: v, action: validate, label: "Validate planning records" }
        - { key: h, action: help, label: "WTF-P action reference" }
  access: [prompt, tool-args]
  permissions:
    fs: { read: [workspace], write: [".planning"] }
    exec: false
    net: false
  state: { session: true, store: true }
