{"id":"cade263f-4e0b-45a0-8893-732081d4e5d4","entityType":"agent","slug":"clawhub-toliuweijing-draft-agent-loop","name":"Draft Agent Loop","canonicalUrl":"https://www.xpersona.co/agent/clawhub-toliuweijing-draft-agent-loop","canonicalPath":"/agent/clawhub-toliuweijing-draft-agent-loop","generatedAt":"2026-10-13T04:40:27.572Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T23:17:56.656Z","emptyReason":null},"description":"Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents. Use this skill when the user wants structured oversight over an agent task: plan appro...","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 978 downloads reported by the source. Last updated 10/11/2026.","installCommand":"clawhub skill install s1792my6kfgvzgtqavh11j5h0h83grgt:draft-agent-loop","sourceUrl":"https://clawhub.ai/toliuweijing/draft-agent-loop","homepage":"https://clawhub.ai/toliuweijing/skills/draft-agent-loop","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/toliuweijing/draft-agent-loop","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/toliuweijing/skills/draft-agent-loop","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":60,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Draft Agent Loop technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust metadata."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-11T23:17:56.656Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T23:17:56.656Z","emptyReason":null},"stars":null,"forks":null,"downloads":978,"likes":null,"task":null,"library":null,"packageName":null,"latestVersion":"1.6.0","tractionLabel":"978 downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T23:17:56.642Z","emptyReason":null},"lastUpdatedAt":"2026-10-11T23:17:56.656Z","lastCrawledAt":"2026-10-11T23:17:56.642Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-12T23:17:56.642Z","lastVerifiedAt":null,"highlights":[{"version":"1.6.0","createdAt":"2026-04-21T06:57:49.549Z","changelog":"**Dependency change for compatibility and consolidation.** - Replaced `draft-headless-pages` dependency with the canonical `draft-cli` dependency. - Updated skill description and instructions to reference `draft-cli` throughout. - Adjusted setup and recovery instructions to match `draft-cli` usage and conventions. - No changes to overall workflow logic or HITRL phases.","fileCount":3,"zipByteSize":5087},{"version":"1.5.14","createdAt":"2026-04-21T04:25:28.143Z","changelog":"- Default invite code now set to \"innosage\" if GLOBAL_INVITE_CODE is not provided, simplifying publishing during free beta testing. - GLOBAL_INVITE_CODE environment variable is now optional instead of required. - Updated documentation to reflect the new invite code default behavior in publish commands and env var description. - No functional or workflow changes; documentation and setup instructions clarified.","fileCount":2,"zipByteSize":3932},{"version":"1.5.13","createdAt":"2026-04-20T06:44:24.552Z","changelog":"- Updated all sample bash publish commands to use the environment variable `$GLOBAL_INVITE_CODE` instead of the literal string `innosage`. - Clarified language in the **Scope** note to specifically mention orchestration by the draft CLI. - No logic changes; adjustment improves flexibility and clarity for publishing Draft pages in varied environments.","fileCount":2,"zipByteSize":3925},{"version":"1.5.12","createdAt":"2026-04-20T06:38:02.641Z","changelog":"- Switched dependency from `draft-cli` to `draft-headless-pages`, enabling support for headless Draft workflows and OpenClaw-style remote environments. - Updated setup and operational instructions to require `draft ... --runtime v2` and follow `draft-headless-pages` runtime checks. - Clarified that page automation and journal workflows now use the headless runtime only—no more local or indexDB-backed modes. - Improved trigger guidance to align with headless/remote use cases and defer direct Draft command workflows to `draft-headless-pages` where no approval gates are needed. - Updated metadata to reflect new dependency and more accurate usage constraints.","fileCount":2,"zipByteSize":3944},{"version":"1.5.11","createdAt":"2026-04-18T00:13:22.724Z","changelog":"- Added environment and install details to metadata, including required binaries and environment variables. - Now requires the GLOBAL_INVITE_CODE environment variable for safe Draft page publishing. - Specified npm installation instructions for draft-cli dependency in the metadata. - No changes to the core HITRL workflow or operational guidance.","fileCount":2,"zipByteSize":3926},{"version":"1.5.10","createdAt":"2026-04-17T23:52:45.325Z","changelog":"- Bumped version from 1.5.9 to 1.5.10. - Removed the unused \"requires\" section under metadata in SKILL.md. - No changes to skill behavior or documentation content.","fileCount":2,"zipByteSize":3771},{"version":"1.5.9","createdAt":"2026-04-17T23:48:30.759Z","changelog":"- Updated metadata: added a \"version\" field and changed dependency structure to reference \"toliuweijing/draft-cli\" with URL and required bin. - Changed metadata key from \"clawdbot\" to \"clawdis\" and clarified formatting. - Incremented version to 1.5.9 in the frontmatter. - No changes to the main instructional content or workflow logic.","fileCount":2,"zipByteSize":3785},{"version":"1.5.8","createdAt":"2026-04-17T07:12:25.900Z","changelog":"**Adds explicit draft page publish commands and tightens non-goals** - Specifies the `draft page publish <id> --invite-code innosage --json` command for both plan and results publishing phases. - Removes generic reference to \"refer to the `draft-cli` skill for the canonical publish command,\" making the publishing process explicit. - Expands Non-Goals with detailed, concrete restrictions and security reminders. - No behavioral or API changes to the core process; documentation and usage instructions improved.","fileCount":2,"zipByteSize":3742}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s1792my6kfgvzgtqavh11j5h0h83grgt:draft-agent-loop","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s1792my6kfgvzgtqavh11j5h0h83grgt:draft-agent-loop` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/toliuweijing/draft-agent-loop before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-toliuweijing-draft-agent-loop/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-toliuweijing-draft-agent-loop/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-toliuweijing-draft-agent-loop/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-toliuweijing-draft-agent-loop/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-toliuweijing-draft-agent-loop/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-toliuweijing-draft-agent-loop/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-13T04:40:27.571Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-toliuweijing-draft-agent-loop/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-toliuweijing-draft-agent-loop/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-toliuweijing-draft-agent-loop/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-toliuweijing-draft-agent-loop/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T23:17:56.656Z","emptyReason":null},"readme":"Skill: Draft Agent Loop\n\nOwner: toliuweijing\n\nSummary: Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents. Use this skill when the user wants structured oversight over an agent task: plan appro...\n\nTags: latest:1.6.0\n\nVersion history:\n\nv1.6.0 | 2026-04-21T06:57:49.549Z | auto\n\n**Dependency change for compatibility and consolidation.**\n- Replaced `draft-headless-pages` dependency with the canonical `draft-cli` dependency.\n- Updated skill description and instructions to reference `draft-cli` throughout.\n- Adjusted setup and recovery instructions to match `draft-cli` usage and conventions.\n- No changes to overall workflow logic or HITRL phases.\n\nv1.5.14 | 2026-04-21T04:25:28.143Z | auto\n\n- Default invite code now set to \"innosage\" if GLOBAL_INVITE_CODE is not provided, simplifying publishing during free beta testing.\n- GLOBAL_INVITE_CODE environment variable is now optional instead of required.\n- Updated documentation to reflect the new invite code default behavior in publish commands and env var description.\n- No functional or workflow changes; documentation and setup instructions clarified.\n\nv1.5.13 | 2026-04-20T06:44:24.552Z | auto\n\n- Updated all sample bash publish commands to use the environment variable `$GLOBAL_INVITE_CODE` instead of the literal string `innosage`.\n- Clarified language in the **Scope** note to specifically mention orchestration by the draft CLI.\n- No logic changes; adjustment improves flexibility and clarity for publishing Draft pages in varied environments.\n\nv1.5.12 | 2026-04-20T06:38:02.641Z | auto\n\n- Switched dependency from `draft-cli` to `draft-headless-pages`, enabling support for headless Draft workflows and OpenClaw-style remote environments.\n- Updated setup and operational instructions to require `draft ... --runtime v2` and follow `draft-headless-pages` runtime checks.\n- Clarified that page automation and journal workflows now use the headless runtime only—no more local or indexDB-backed modes.\n- Improved trigger guidance to align with headless/remote use cases and defer direct Draft command workflows to `draft-headless-pages` where no approval gates are needed.\n- Updated metadata to reflect new dependency and more accurate usage constraints.\n\nv1.5.11 | 2026-04-18T00:13:22.724Z | auto\n\n- Added environment and install details to metadata, including required binaries and environment variables.\n- Now requires the GLOBAL_INVITE_CODE environment variable for safe Draft page publishing.\n- Specified npm installation instructions for draft-cli dependency in the metadata.\n- No changes to the core HITRL workflow or operational guidance.\n\nv1.5.10 | 2026-04-17T23:52:45.325Z | auto\n\n- Bumped version from 1.5.9 to 1.5.10.\n- Removed the unused \"requires\" section under metadata in SKILL.md.\n- No changes to skill behavior or documentation content.\n\nv1.5.9 | 2026-04-17T23:48:30.759Z | auto\n\n- Updated metadata: added a \"version\" field and changed dependency structure to reference \"toliuweijing/draft-cli\" with URL and required bin.\n- Changed metadata key from \"clawdbot\" to \"clawdis\" and clarified formatting.\n- Incremented version to 1.5.9 in the frontmatter.\n- No changes to the main instructional content or workflow logic.\n\nv1.5.8 | 2026-04-17T07:12:25.900Z | auto\n\n**Adds explicit draft page publish commands and tightens non-goals**\n\n- Specifies the `draft page publish <id> --invite-code innosage --json` command for both plan and results publishing phases.\n- Removes generic reference to \"refer to the `draft-cli` skill for the canonical publish command,\" making the publishing process explicit.\n- Expands Non-Goals with detailed, concrete restrictions and security reminders.\n- No behavioral or API changes to the core process; documentation and usage instructions improved.\n\nv1.5.7 | 2026-04-16T11:59:09.371Z | auto\n\n### draft-agent-loop v1.5.7\n\n- Updated metadata version to 1.5.7.\n- Clarified publishing instructions in Phase 1 and Phase 3: replaced hardcoded draft-cli commands with references to using canonical publish commands from the draft-cli skill, noting environment-specific requirements.\n- Added new execution boundaries in Phase 2: explicitly restricts file access, config changes, and use of credentials to the approved plan scope; emphasizes adherence to project standards and avoidance of side effects.\n- Other usage guidance and operational rules remain unchanged.\n\nv1.5.6 | 2026-04-16T11:40:05.529Z | auto\n\n- Clarified that the skill is instruction-only: no install scripts, code files, or local filesystem writes—only Draft page-based persistence.\n- Updated local mode explanation: operates via indexDB/browser storage with no workspace mount or shared file access required.\n- Added security guidance: never include credentials, secrets, PII, or raw file/command outputs in logs or plan documents.\n- Introduced explicit user confirmation before publishing or re-publishing Draft pages at Plan and Verify phases.\n- Archive/final memory phase now appends a summary only within the Draft page—no writes to `TASK_LOG.md` or local files.\n- Revised description and rules to emphasize that all task data remains in Draft; local disk or agent memory storage is out of scope.\n\nv1.5.5 | 2026-04-16T09:45:01.590Z | auto\n\n- Documentation and metadata update only; no logic or functional changes.\n- Clarified that local-file authoring workflows are out of scope in trigger guidance.\n- Removed \"compatibility\" field from metadata, now using \"version\":\"1.5.5\" to track release.\n- Minor edits for conciseness and accuracy in the SKILL.md description and guidance.\n\nv1.5.4 | 2026-04-16T09:32:30.099Z | auto\n\n- Clarified trigger phrases and guidance for when to use draft-agent-loop vs. other skills.\n- Expanded and detailed the HITRL (Human-in-the-Right-Loop) lifecycle, emphasizing plan approval, execution logging, and result sign-off.\n- Introduced stricter phase-by-phase procedures, including mandatory command templates and evidence-logging requirements.\n- Explicitly documented fallback and recovery procedures for Draft connection issues.\n- Added clear iteration loop process for handling user feedback and re-approvals.\n\nArchive index:\n\nArchive v1.6.0: 3 files, 5087 bytes\n\nFiles: skill-card.md (2080b), SKILL.md (8347b), _meta.json (135b)\n\nFile v1.6.0:SKILL.md\n\n---\nname: draft-agent-loop\nversion: \"1.6.0\"\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the canonical draft-cli skill. It assumes headless page workflows under `draft ... --runtime v2`, which fit remote OpenClaw-style isolated environments.\nmetadata:\n  clawdis:\n    emoji: \"🔄\"\n    dependencies:\n      - name: \"toliuweijing/draft-cli\"\n        type: \"other\"\n        url: \"https://clawhub.ai/toliuweijing/draft-cli\"\n    requires:\n      bins:\n        - \"draft\"\n    install:\n      - id: \"npm\"\n        kind: \"node\"\n        package: \"@innosage/draft-cli\"\n        bins:\n          - \"draft\"\n        label: \"Install draft-cli (npm)\"\n    envVars:\n      - name: \"GLOBAL_INVITE_CODE\"\n        required: false\n        description: \"The invite code used to publish Draft pages safely. Defaults to `innosage` during the free beta publish flow.\"\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This skill orchestrates remote agent workflows using the `draft` CLI. All persistence is through Draft pages (via the canonical `draft-cli` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about raw Draft commands or page automation without approval gates (use `draft-cli`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use headless page mode through `draft ... --runtime v2`.\n- **Runtime dependency**: Follow the startup and page-operation rules from `draft-cli`.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensitive Data in Logs**: Do NOT include credentials, secrets, tokens, or PII in execution log entries or plan documents. Limit evidence to status indicators and non-sensitive file names.\n\n## Phase 0: Setup & Connection\n\nBefore doing anything, establish a stable Draft connection:\n\n```bash\n# 1. Start the daemon in headless runtime v2\ndraft start-server\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json\n```\n\nIf `draft status` does not show a healthy `v2` headless session, follow the `draft-cli` recovery pattern:\n- `DAEMON_OFFLINE` → re-run `draft start-server`\n- wrong runtime selected → stop and correct runtime before writing\n- Only proceed once `draft status --json` shows a healthy headless `v2` session\n\n## Phase 1: Plan (Proposal & Approval)\n\nBefore executing any code or changes:\n\n1.  **Create Journal**: Create a new Draft page titled `<Task Name> - Task Journal`.\n    ```bash\n    draft page create \"<Task Name> - Task Journal\" --json\n    ```\n2.  **Submit Plan**: Author a detailed Task Journal using the mandatory template. Append it to the Journal.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF\n    ```\n3.  **Confirm Before Publishing**: Before publishing, explicitly confirm with the user: \"I am about to publish the Task Journal for external review. Please confirm.\"\n4.  **Handoff**: On confirmation, publish the page and ask for approval.\n    ```bash\n    draft page publish <id> --invite-code \"${GLOBAL_INVITE_CODE:-innosage}\" --json\n    ```\n    **Handoff Phrase**: \"I have initialized the Task Journal with the plan and requirements: [URL]. Please review the context and acceptance criteria. Once you are ready for me to proceed, please reply with **APPROVED** or **LGTM** here in the chat.\"\n\n5.  **Wait**: STOP. Do not proceed until the user explicitly tells you to continue in the chat. Note: Do not rely on Draft page comments for approval on remote/public pages.\n\n## Phase 2: Execute (Action & Logging)\n\nOnce approved:\n\n1.  **Verify Approval**: Confirm the user has provided approval in the chat.\n2.  **Execute**: Perform the tasks outlined in the plan.\n3.  **Log Evidence**: For every significant action, append a concise, non-sensitive log entry to the Journal under a `# 📜 Execution Log` section. Do NOT include raw command output, file contents, or credentials.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF\n    ```\n\n## Phase 3: Verify (Result & Sign-off)\n\nOnce the execution is complete:\n\n1.  **Submit Results**: Append a `# ✅ Final Results` summary to the Journal. Include links to artifacts (e.g., PR URL, Draft page URL). Do not include raw file dumps.\n2.  **Confirm Before Publishing**: Explicitly confirm with the user before re-publishing.\n3.  **Handoff**: On confirmation, re-publish the page.\n    ```bash\n    draft page publish <id> --invite-code \"${GLOBAL_INVITE_CODE:-innosage}\" --json\n    ```\n    **Handoff Phrase**: \"I have completed the task. Please verify the results in the Task Journal: [URL]. If satisfied, reply with **DONE** or **✅** here in the chat.\"\n\n4.  **Wait**: STOP. If the user provides sign-off (**DONE** / **✅**), proceed to Phase 4. If feedback is received, enter the Iteration Loop.\n\n## Phase 4: Archive (Draft Page Only)\n\nAfter sign-off, append a final summary to the existing Task Journal page. This keeps all persistence within Draft — no local filesystem writes.\n\n```bash\ncat << 'EOF' | draft page append <id> --json\n# 🗂 Task Complete — Summary\n- **Outcome**: [Brief description of what was achieved]\n- **Key Decisions**: [Any notable trade-offs or design choices]\n- **Artifacts**: [Links to PR, relevant files, or external references]\nEOF\n```\n\n> The Draft page itself (with its page ID and URL) is the durable record. No additional writes to `TASK_LOG.md`, `knowledge/`, or other filesystem locations are required or expected.\n\n## Iteration Loop\n\nIf the user provides feedback or requests changes after Phase 3:\n1.  **Acknowledge**: Acknowledge the feedback in the chat.\n2.  **Start New Iteration**: Enter Phase 1 again to propose how you will address the feedback.\n3.  **Append to Same Page**: Do NOT create a new page. Append the new plan to the existing Task Journal under a new heading: `# 📋 Iteration [N]: Addressing Feedback`.\n4.  **Template**: Use the mandatory Phase 1 template for each new iteration to maintain context and traceability.\n\n## Non-Goals\n\n- Do NOT use browser-backed v1 or `--mode workspace`.\n- Do NOT skip the plan approval gate.\n- Do NOT execute multiple un-logged steps.\n- Do NOT write to local agent filesystem (no `TASK_LOG.md`, no `knowledge/` writes).\n- Do NOT include credentials, PII, or sensitive command outputs in Draft page content.\n\nFile v1.6.0:_meta.json\n\n{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.6.0\",\n  \"publishedAt\": 1776754669549\n}\n\nFile v1.6.0:skill-card.md\n\n## Description:\n\nEnforces a Human-in-the-Right-Loop lifecycle for remote agent tasks with plan approval, evidence-logged execution, and result sign-off gates.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[toliuweijing](https://clawhub.ai/user/toliuweijing)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and agent operators use this skill when they need structured human oversight for remote agent work, including approval before execution and explicit sign-off before task closure.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Task journals are persisted in Draft pages and may be published for review.\n\nMitigation: Avoid including secrets, tokens, sensitive personal data, or raw command output in plans, logs, and result summaries.\n\nRisk: The skill depends on an external, unpinned draft-cli installation.\n\nMitigation: Use a pinned or otherwise verified draft-cli dependency in higher-risk environments.\n\nRisk: Approval gates can be bypassed if the agent proceeds without explicit chat confirmation.\n\nMitigation: Require approval and sign-off phrases in chat before moving between planning, execution, and closure phases.\n\n## Reference(s):\n\n- [Draft Agent Loop on ClawHub](https://clawhub.ai/toliuweijing/skills/draft-agent-loop)\n- [draft-cli dependency on ClawHub](https://clawhub.ai/toliuweijing/draft-cli)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, Shell commands, Configuration, Guidance]\n\n**Output Format:** [Markdown guidance with inline shell commands and task-journal templates]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Requires the draft CLI and may use GLOBAL_INVITE_CODE for publishing Draft pages.]\n\n## Skill Version(s):\n\n1.6.0 (source: release evidence and skill frontmatter)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.5.14: 2 files, 3932 bytes\n\nFiles: SKILL.md (8431b), _meta.json (136b)\n\nFile v1.5.14:SKILL.md\n\n---\nname: draft-agent-loop\nversion: \"1.5.14\"\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the draft-headless-pages skill. It assumes headless page workflows under `draft ... --runtime v2`, which fit remote OpenClaw-style isolated environments.\nmetadata:\n  clawdis:\n    emoji: \"🔄\"\n    dependencies:\n      - name: \"toliuweijing/draft-headless-pages\"\n        type: \"other\"\n        url: \"https://clawhub.ai/toliuweijing/draft-headless-pages\"\n    requires:\n      bins:\n        - \"draft\"\n    install:\n      - id: \"npm\"\n        kind: \"node\"\n        package: \"@innosage/draft-cli\"\n        bins:\n          - \"draft\"\n        label: \"Install draft-cli (npm)\"\n    envVars:\n      - name: \"GLOBAL_INVITE_CODE\"\n        required: false\n        description: \"The invite code used to publish Draft pages safely. Defaults to `innosage` during the free beta publish flow.\"\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This skill orchestrates remote agent workflows using the `draft` CLI. All persistence is through Draft pages (via the `draft-headless-pages` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about raw Draft commands or page automation without approval gates (use `draft-headless-pages`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use headless page mode through `draft ... --runtime v2`.\n- **Runtime dependency**: Follow the startup and page-operation rules from `draft-headless-pages`.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensitive Data in Logs**: Do NOT include credentials, secrets, tokens, or PII in execution log entries or plan documents. Limit evidence to status indicators and non-sensitive file names.\n\n## Phase 0: Setup & Connection\n\nBefore doing anything, establish a stable Draft connection:\n\n```bash\n# 1. Start the daemon in headless runtime v2\ndraft start-server --runtime v2\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json\n```\n\nIf `draft status` does not show a healthy `v2` headless session, follow the `draft-headless-pages` recovery pattern:\n- `DAEMON_OFFLINE` → re-run `draft start-server --runtime v2`\n- wrong runtime selected → stop and correct runtime before writing\n- Only proceed once `draft status --json` shows a healthy headless `v2` session\n\n## Phase 1: Plan (Proposal & Approval)\n\nBefore executing any code or changes:\n\n1.  **Create Journal**: Create a new Draft page titled `<Task Name> - Task Journal`.\n    ```bash\n    draft page create \"<Task Name> - Task Journal\" --json\n    ```\n2.  **Submit Plan**: Author a detailed Task Journal using the mandatory template. Append it to the Journal.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF\n    ```\n3.  **Confirm Before Publishing**: Before publishing, explicitly confirm with the user: \"I am about to publish the Task Journal for external review. Please confirm.\"\n4.  **Handoff**: On confirmation, publish the page and ask for approval.\n    ```bash\n    draft page publish <id> --invite-code \"${GLOBAL_INVITE_CODE:-innosage}\" --json\n    ```\n    **Handoff Phrase**: \"I have initialized the Task Journal with the plan and requirements: [URL]. Please review the context and acceptance criteria. Once you are ready for me to proceed, please reply with **APPROVED** or **LGTM** here in the chat.\"\n\n5.  **Wait**: STOP. Do not proceed until the user explicitly tells you to continue in the chat. Note: Do not rely on Draft page comments for approval on remote/public pages.\n\n## Phase 2: Execute (Action & Logging)\n\nOnce approved:\n\n1.  **Verify Approval**: Confirm the user has provided approval in the chat.\n2.  **Execute**: Perform the tasks outlined in the plan.\n3.  **Log Evidence**: For every significant action, append a concise, non-sensitive log entry to the Journal under a `# 📜 Execution Log` section. Do NOT include raw command output, file contents, or credentials.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF\n    ```\n\n## Phase 3: Verify (Result & Sign-off)\n\nOnce the execution is complete:\n\n1.  **Submit Results**: Append a `# ✅ Final Results` summary to the Journal. Include links to artifacts (e.g., PR URL, Draft page URL). Do not include raw file dumps.\n2.  **Confirm Before Publishing**: Explicitly confirm with the user before re-publishing.\n3.  **Handoff**: On confirmation, re-publish the page.\n    ```bash\n    draft page publish <id> --invite-code \"${GLOBAL_INVITE_CODE:-innosage}\" --json\n    ```\n    **Handoff Phrase**: \"I have completed the task. Please verify the results in the Task Journal: [URL]. If satisfied, reply with **DONE** or **✅** here in the chat.\"\n\n4.  **Wait**: STOP. If the user provides sign-off (**DONE** / **✅**), proceed to Phase 4. If feedback is received, enter the Iteration Loop.\n\n## Phase 4: Archive (Draft Page Only)\n\nAfter sign-off, append a final summary to the existing Task Journal page. This keeps all persistence within Draft — no local filesystem writes.\n\n```bash\ncat << 'EOF' | draft page append <id> --json\n# 🗂 Task Complete — Summary\n- **Outcome**: [Brief description of what was achieved]\n- **Key Decisions**: [Any notable trade-offs or design choices]\n- **Artifacts**: [Links to PR, relevant files, or external references]\nEOF\n```\n\n> The Draft page itself (with its page ID and URL) is the durable record. No additional writes to `TASK_LOG.md`, `knowledge/`, or other filesystem locations are required or expected.\n\n## Iteration Loop\n\nIf the user provides feedback or requests changes after Phase 3:\n1.  **Acknowledge**: Acknowledge the feedback in the chat.\n2.  **Start New Iteration**: Enter Phase 1 again to propose how you will address the feedback.\n3.  **Append to Same Page**: Do NOT create a new page. Append the new plan to the existing Task Journal under a new heading: `# 📋 Iteration [N]: Addressing Feedback`.\n4.  **Template**: Use the mandatory Phase 1 template for each new iteration to maintain context and traceability.\n\n## Non-Goals\n\n- Do NOT use browser-backed v1 or `--mode workspace`.\n- Do NOT skip the plan approval gate.\n- Do NOT execute multiple un-logged steps.\n- Do NOT write to local agent filesystem (no `TASK_LOG.md`, no `knowledge/` writes).\n- Do NOT include credentials, PII, or sensitive command outputs in Draft page content.\n\nFile v1.5.14:_meta.json\n\n{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.5.14\",\n  \"publishedAt\": 1776745528143\n}\n\nArchive v1.5.13: 2 files, 3925 bytes\n\nFiles: SKILL.md (8440b), _meta.json (136b)\n\nFile v1.5.13:SKILL.md\n\n---\nname: draft-agent-loop\nversion: \"1.5.13\"\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the draft-headless-pages skill. It assumes headless page workflows under `draft ... --runtime v2`, which fit remote OpenClaw-style isolated environments.\nmetadata:\n  clawdis:\n    emoji: \"🔄\"\n    dependencies:\n      - name: \"toliuweijing/draft-headless-pages\"\n        type: \"other\"\n        url: \"https://clawhub.ai/toliuweijing/draft-headless-pages\"\n    requires:\n      bins:\n        - \"draft\"\n      env:\n        - \"GLOBAL_INVITE_CODE\"\n    install:\n      - id: \"npm\"\n        kind: \"node\"\n        package: \"@innosage/draft-cli\"\n        bins:\n          - \"draft\"\n        label: \"Install draft-cli (npm)\"\n    envVars:\n      - name: \"GLOBAL_INVITE_CODE\"\n        required: true\n        description: \"The invite code required to publish Draft pages safely. It can be used for free during the beta test.\"\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This skill orchestrates remote agent workflows using the `draft` CLI. All persistence is through Draft pages (via the `draft-headless-pages` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about raw Draft commands or page automation without approval gates (use `draft-headless-pages`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use headless page mode through `draft ... --runtime v2`.\n- **Runtime dependency**: Follow the startup and page-operation rules from `draft-headless-pages`.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensitive Data in Logs**: Do NOT include credentials, secrets, tokens, or PII in execution log entries or plan documents. Limit evidence to status indicators and non-sensitive file names.\n\n## Phase 0: Setup & Connection\n\nBefore doing anything, establish a stable Draft connection:\n\n```bash\n# 1. Start the daemon in headless runtime v2\ndraft start-server --runtime v2\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json\n```\n\nIf `draft status` does not show a healthy `v2` headless session, follow the `draft-headless-pages` recovery pattern:\n- `DAEMON_OFFLINE` → re-run `draft start-server --runtime v2`\n- wrong runtime selected → stop and correct runtime before writing\n- Only proceed once `draft status --json` shows a healthy headless `v2` session\n\n## Phase 1: Plan (Proposal & Approval)\n\nBefore executing any code or changes:\n\n1.  **Create Journal**: Create a new Draft page titled `<Task Name> - Task Journal`.\n    ```bash\n    draft page create \"<Task Name> - Task Journal\" --json\n    ```\n2.  **Submit Plan**: Author a detailed Task Journal using the mandatory template. Append it to the Journal.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF\n    ```\n3.  **Confirm Before Publishing**: Before publishing, explicitly confirm with the user: \"I am about to publish the Task Journal for external review. Please confirm.\"\n4.  **Handoff**: On confirmation, publish the page and ask for approval.\n    ```bash\n    draft page publish <id> --invite-code \"$GLOBAL_INVITE_CODE\" --json\n    ```\n    **Handoff Phrase**: \"I have initialized the Task Journal with the plan and requirements: [URL]. Please review the context and acceptance criteria. Once you are ready for me to proceed, please reply with **APPROVED** or **LGTM** here in the chat.\"\n\n5.  **Wait**: STOP. Do not proceed until the user explicitly tells you to continue in the chat. Note: Do not rely on Draft page comments for approval on remote/public pages.\n\n## Phase 2: Execute (Action & Logging)\n\nOnce approved:\n\n1.  **Verify Approval**: Confirm the user has provided approval in the chat.\n2.  **Execute**: Perform the tasks outlined in the plan.\n3.  **Log Evidence**: For every significant action, append a concise, non-sensitive log entry to the Journal under a `# 📜 Execution Log` section. Do NOT include raw command output, file contents, or credentials.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF\n    ```\n\n## Phase 3: Verify (Result & Sign-off)\n\nOnce the execution is complete:\n\n1.  **Submit Results**: Append a `# ✅ Final Results` summary to the Journal. Include links to artifacts (e.g., PR URL, Draft page URL). Do not include raw file dumps.\n2.  **Confirm Before Publishing**: Explicitly confirm with the user before re-publishing.\n3.  **Handoff**: On confirmation, re-publish the page.\n    ```bash\n    draft page publish <id> --invite-code \"$GLOBAL_INVITE_CODE\" --json\n    ```\n    **Handoff Phrase**: \"I have completed the task. Please verify the results in the Task Journal: [URL]. If satisfied, reply with **DONE** or **✅** here in the chat.\"\n\n4.  **Wait**: STOP. If the user provides sign-off (**DONE** / **✅**), proceed to Phase 4. If feedback is received, enter the Iteration Loop.\n\n## Phase 4: Archive (Draft Page Only)\n\nAfter sign-off, append a final summary to the existing Task Journal page. This keeps all persistence within Draft — no local filesystem writes.\n\n```bash\ncat << 'EOF' | draft page append <id> --json\n# 🗂 Task Complete — Summary\n- **Outcome**: [Brief description of what was achieved]\n- **Key Decisions**: [Any notable trade-offs or design choices]\n- **Artifacts**: [Links to PR, relevant files, or external references]\nEOF\n```\n\n> The Draft page itself (with its page ID and URL) is the durable record. No additional writes to `TASK_LOG.md`, `knowledge/`, or other filesystem locations are required or expected.\n\n## Iteration Loop\n\nIf the user provides feedback or requests changes after Phase 3:\n1.  **Acknowledge**: Acknowledge the feedback in the chat.\n2.  **Start New Iteration**: Enter Phase 1 again to propose how you will address the feedback.\n3.  **Append to Same Page**: Do NOT create a new page. Append the new plan to the existing Task Journal under a new heading: `# 📋 Iteration [N]: Addressing Feedback`.\n4.  **Template**: Use the mandatory Phase 1 template for each new iteration to maintain context and traceability.\n\n## Non-Goals\n\n- Do NOT use browser-backed v1 or `--mode workspace`.\n- Do NOT skip the plan approval gate.\n- Do NOT execute multiple un-logged steps.\n- Do NOT write to local agent filesystem (no `TASK_LOG.md`, no `knowledge/` writes).\n- Do NOT include credentials, PII, or sensitive command outputs in Draft page content.\n\nFile v1.5.13:_meta.json\n\n{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.5.13\",\n  \"publishedAt\": 1776667464552\n}\n\nArchive v1.5.12: 2 files, 3944 bytes\n\nFiles: SKILL.md (8448b), _meta.json (136b)\n\nFile v1.5.12:SKILL.md\n\n---\nname: draft-agent-loop\nversion: \"1.5.12\"\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the draft-headless-pages skill. It assumes headless page workflows under `draft ... --runtime v2`, which fit remote OpenClaw-style isolated environments.\nmetadata:\n  clawdis:\n    emoji: \"🔄\"\n    dependencies:\n      - name: \"toliuweijing/draft-headless-pages\"\n        type: \"other\"\n        url: \"https://clawhub.ai/toliuweijing/draft-headless-pages\"\n    requires:\n      bins:\n        - \"draft\"\n      env:\n        - \"GLOBAL_INVITE_CODE\"\n    install:\n      - id: \"npm\"\n        kind: \"node\"\n        package: \"@innosage/draft-cli\"\n        bins:\n          - \"draft\"\n        label: \"Install draft-cli (npm)\"\n    envVars:\n      - name: \"GLOBAL_INVITE_CODE\"\n        required: true\n        description: \"The invite code required to publish Draft pages safely. It can be used for free during the beta test.\"\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This is an instruction-only skill. It has no install scripts, code files, or declared filesystem paths. All persistence is through Draft pages (via the `draft-headless-pages` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about raw Draft commands or page automation without approval gates (use `draft-headless-pages`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use headless page mode through `draft ... --runtime v2`.\n- **Runtime dependency**: Follow the startup and page-operation rules from `draft-headless-pages`.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensitive Data in Logs**: Do NOT include credentials, secrets, tokens, or PII in execution log entries or plan documents. Limit evidence to status indicators and non-sensitive file names.\n\n## Phase 0: Setup & Connection\n\nBefore doing anything, establish a stable Draft connection:\n\n```bash\n# 1. Start the daemon in headless runtime v2\ndraft start-server --runtime v2\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json\n```\n\nIf `draft status` does not show a healthy `v2` headless session, follow the `draft-headless-pages` recovery pattern:\n- `DAEMON_OFFLINE` → re-run `draft start-server --runtime v2`\n- wrong runtime selected → stop and correct runtime before writing\n- Only proceed once `draft status --json` shows a healthy headless `v2` session\n\n## Phase 1: Plan (Proposal & Approval)\n\nBefore executing any code or changes:\n\n1.  **Create Journal**: Create a new Draft page titled `<Task Name> - Task Journal`.\n    ```bash\n    draft page create \"<Task Name> - Task Journal\" --json\n    ```\n2.  **Submit Plan**: Author a detailed Task Journal using the mandatory template. Append it to the Journal.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF\n    ```\n3.  **Confirm Before Publishing**: Before publishing, explicitly confirm with the user: \"I am about to publish the Task Journal for external review. Please confirm.\"\n4.  **Handoff**: On confirmation, publish the page and ask for approval.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have initialized the Task Journal with the plan and requirements: [URL]. Please review the context and acceptance criteria. Once you are ready for me to proceed, please reply with **APPROVED** or **LGTM** here in the chat.\"\n\n5.  **Wait**: STOP. Do not proceed until the user explicitly tells you to continue in the chat. Note: Do not rely on Draft page comments for approval on remote/public pages.\n\n## Phase 2: Execute (Action & Logging)\n\nOnce approved:\n\n1.  **Verify Approval**: Confirm the user has provided approval in the chat.\n2.  **Execute**: Perform the tasks outlined in the plan.\n3.  **Log Evidence**: For every significant action, append a concise, non-sensitive log entry to the Journal under a `# 📜 Execution Log` section. Do NOT include raw command output, file contents, or credentials.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF\n    ```\n\n## Phase 3: Verify (Result & Sign-off)\n\nOnce the execution is complete:\n\n1.  **Submit Results**: Append a `# ✅ Final Results` summary to the Journal. Include links to artifacts (e.g., PR URL, Draft page URL). Do not include raw file dumps.\n2.  **Confirm Before Publishing**: Explicitly confirm with the user before re-publishing.\n3.  **Handoff**: On confirmation, re-publish the page.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have completed the task. Please verify the results in the Task Journal: [URL]. If satisfied, reply with **DONE** or **✅** here in the chat.\"\n\n4.  **Wait**: STOP. If the user provides sign-off (**DONE** / **✅**), proceed to Phase 4. If feedback is received, enter the Iteration Loop.\n\n## Phase 4: Archive (Draft Page Only)\n\nAfter sign-off, append a final summary to the existing Task Journal page. This keeps all persistence within Draft — no local filesystem writes.\n\n```bash\ncat << 'EOF' | draft page append <id> --json\n# 🗂 Task Complete — Summary\n- **Outcome**: [Brief description of what was achieved]\n- **Key Decisions**: [Any notable trade-offs or design choices]\n- **Artifacts**: [Links to PR, relevant files, or external references]\nEOF\n```\n\n> The Draft page itself (with its page ID and URL) is the durable record. No additional writes to `TASK_LOG.md`, `knowledge/`, or other filesystem locations are required or expected.\n\n## Iteration Loop\n\nIf the user provides feedback or requests changes after Phase 3:\n1.  **Acknowledge**: Acknowledge the feedback in the chat.\n2.  **Start New Iteration**: Enter Phase 1 again to propose how you will address the feedback.\n3.  **Append to Same Page**: Do NOT create a new page. Append the new plan to the existing Task Journal under a new heading: `# 📋 Iteration [N]: Addressing Feedback`.\n4.  **Template**: Use the mandatory Phase 1 template for each new iteration to maintain context and traceability.\n\n## Non-Goals\n\n- Do NOT use browser-backed v1 or `--mode workspace`.\n- Do NOT skip the plan approval gate.\n- Do NOT execute multiple un-logged steps.\n- Do NOT write to local agent filesystem (no `TASK_LOG.md`, no `knowledge/` writes).\n- Do NOT include credentials, PII, or sensitive command outputs in Draft page content.\n\nFile v1.5.12:_meta.json\n\n{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.5.12\",\n  \"publishedAt\": 1776667082641\n}\n\nArchive v1.5.11: 2 files, 3926 bytes\n\nFiles: SKILL.md (8426b), _meta.json (136b)\n\nFile v1.5.11:SKILL.md\n\n---\nname: draft-agent-loop\nversion: \"1.5.11\"\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the draft-cli skill. It runs draft-cli in local mode (indexDB-backed, no shared filesystem required), which enables page publishing without a workspace mount.\nmetadata:\n  clawdis:\n    emoji: \"🔄\"\n    dependencies:\n      - name: \"toliuweijing/draft-cli\"\n        type: \"other\"\n        url: \"https://clawhub.ai/toliuweijing/draft-cli\"\n    requires:\n      bins:\n        - \"draft\"\n      env:\n        - \"GLOBAL_INVITE_CODE\"\n    install:\n      - id: \"npm\"\n        kind: \"node\"\n        package: \"@innosage/draft-cli\"\n        bins:\n          - \"draft\"\n        label: \"Install draft-cli (npm)\"\n    envVars:\n      - name: \"GLOBAL_INVITE_CODE\"\n        required: true\n        description: \"The invite code required to publish Draft pages safely. It can be used for free during the beta test.\"\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This is an instruction-only skill. It has no install scripts, code files, or declared filesystem paths. All persistence is through Draft pages (via the `draft-cli` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about Draft CLI commands (use `draft-cli`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use `draft-cli` in local mode (`draft start-server --mode local`). Never use `--mode workspace`.\n- **Local mode** means Draft stores page data in indexDB (browser local storage) — it does not mount or access any shared filesystem.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensitive Data in Logs**: Do NOT include credentials, secrets, tokens, or PII in execution log entries or plan documents. Limit evidence to status indicators and non-sensitive file names.\n\n## Phase 0: Setup & Connection\n\nBefore doing anything, establish a stable Draft connection:\n\n```bash\n# 1. Start the daemon in local mode (indexDB-backed, no filesystem required)\ndraft start-server --mode local\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json\n```\n\nIf `draft status` does not show `READY`, follow the `draft-cli` connection-first recovery pattern:\n- `DAEMON_OFFLINE` → re-run `draft start-server --mode local`\n- `BROWSER_NOT_CONNECTED` → run `draft daemon` to pair a browser tab\n- Only proceed once `draft status --json` shows `\"state\": \"READY\"`\n\n## Phase 1: Plan (Proposal & Approval)\n\nBefore executing any code or changes:\n\n1.  **Create Journal**: Create a new Draft page titled `<Task Name> - Task Journal`.\n    ```bash\n    draft page create \"<Task Name> - Task Journal\" --json\n    ```\n2.  **Submit Plan**: Author a detailed Task Journal using the mandatory template. Append it to the Journal.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF\n    ```\n3.  **Confirm Before Publishing**: Before publishing, explicitly confirm with the user: \"I am about to publish the Task Journal for external review. Please confirm.\"\n4.  **Handoff**: On confirmation, publish the page and ask for approval.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have initialized the Task Journal with the plan and requirements: [URL]. Please review the context and acceptance criteria. Once you are ready for me to proceed, please reply with **APPROVED** or **LGTM** here in the chat.\"\n\n5.  **Wait**: STOP. Do not proceed until the user explicitly tells you to continue in the chat. Note: Do not rely on Draft page comments for approval on remote/public pages.\n\n## Phase 2: Execute (Action & Logging)\n\nOnce approved:\n\n1.  **Verify Approval**: Confirm the user has provided approval in the chat.\n2.  **Execute**: Perform the tasks outlined in the plan.\n3.  **Log Evidence**: For every significant action, append a concise, non-sensitive log entry to the Journal under a `# 📜 Execution Log` section. Do NOT include raw command output, file contents, or credentials.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF\n    ```\n\n## Phase 3: Verify (Result & Sign-off)\n\nOnce the execution is complete:\n\n1.  **Submit Results**: Append a `# ✅ Final Results` summary to the Journal. Include links to artifacts (e.g., PR URL, Draft page URL). Do not include raw file dumps.\n2.  **Confirm Before Publishing**: Explicitly confirm with the user before re-publishing.\n3.  **Handoff**: On confirmation, re-publish the page.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have completed the task. Please verify the results in the Task Journal: [URL]. If satisfied, reply with **DONE** or **✅** here in the chat.\"\n\n4.  **Wait**: STOP. If the user provides sign-off (**DONE** / **✅**), proceed to Phase 4. If feedback is received, enter the Iteration Loop.\n\n## Phase 4: Archive (Draft Page Only)\n\nAfter sign-off, append a final summary to the existing Task Journal page. This keeps all persistence within Draft — no local filesystem writes.\n\n```bash\ncat << 'EOF' | draft page append <id> --json\n# 🗂 Task Complete — Summary\n- **Outcome**: [Brief description of what was achieved]\n- **Key Decisions**: [Any notable trade-offs or design choices]\n- **Artifacts**: [Links to PR, relevant files, or external references]\nEOF\n```\n\n> The Draft page itself (with its page ID and URL) is the durable record. No additional writes to `TASK_LOG.md`, `knowledge/`, or other filesystem locations are required or expected.\n\n## Iteration Loop\n\nIf the user provides feedback or requests changes after Phase 3:\n1.  **Acknowledge**: Acknowledge the feedback in the chat.\n2.  **Start New Iteration**: Enter Phase 1 again to propose how you will address the feedback.\n3.  **Append to Same Page**: Do NOT create a new page. Append the new plan to the existing Task Journal under a new heading: `# 📋 Iteration [N]: Addressing Feedback`.\n4.  **Template**: Use the mandatory Phase 1 template for each new iteration to maintain context and traceability.\n\n## Non-Goals\n\n- Do NOT use `--mode workspace`.\n- Do NOT skip the plan approval gate.\n- Do NOT execute multiple un-logged steps.\n- Do NOT write to local agent filesystem (no `TASK_LOG.md`, no `knowledge/` writes).\n- Do NOT include credentials, PII, or sensitive command outputs in Draft page content.\n\nFile v1.5.11:_meta.json\n\n{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.5.11\",\n  \"publishedAt\": 1776471202724\n}\n\nArchive v1.5.10: 2 files, 3771 bytes\n\nFiles: SKILL.md (7978b), _meta.json (136b)\n\nFile v1.5.10:SKILL.md\n\n---\nname: draft-agent-loop\nversion: \"1.5.10\"\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the draft-cli skill. It runs draft-cli in local mode (indexDB-backed, no shared filesystem required), which enables page publishing without a workspace mount.\nmetadata:\n  clawdis:\n    emoji: \"🔄\"\n    dependencies:\n      - name: \"toliuweijing/draft-cli\"\n        type: \"other\"\n        url: \"https://clawhub.ai/toliuweijing/draft-cli\"\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This is an instruction-only skill. It has no install scripts, code files, or declared filesystem paths. All persistence is through Draft pages (via the `draft-cli` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about Draft CLI commands (use `draft-cli`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use `draft-cli` in local mode (`draft start-server --mode local`). Never use `--mode workspace`.\n- **Local mode** means Draft stores page data in indexDB (browser local storage) — it does not mount or access any shared filesystem.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensitive Data in Logs**: Do NOT include credentials, secrets, tokens, or PII in execution log entries or plan documents. Limit evidence to status indicators and non-sensitive file names.\n\n## Phase 0: Setup & Connection\n\nBefore doing anything, establish a stable Draft connection:\n\n```bash\n# 1. Start the daemon in local mode (indexDB-backed, no filesystem required)\ndraft start-server --mode local\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json\n```\n\nIf `draft status` does not show `READY`, follow the `draft-cli` connection-first recovery pattern:\n- `DAEMON_OFFLINE` → re-run `draft start-server --mode local`\n- `BROWSER_NOT_CONNECTED` → run `draft daemon` to pair a browser tab\n- Only proceed once `draft status --json` shows `\"state\": \"READY\"`\n\n## Phase 1: Plan (Proposal & Approval)\n\nBefore executing any code or changes:\n\n1.  **Create Journal**: Create a new Draft page titled `<Task Name> - Task Journal`.\n    ```bash\n    draft page create \"<Task Name> - Task Journal\" --json\n    ```\n2.  **Submit Plan**: Author a detailed Task Journal using the mandatory template. Append it to the Journal.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF\n    ```\n3.  **Confirm Before Publishing**: Before publishing, explicitly confirm with the user: \"I am about to publish the Task Journal for external review. Please confirm.\"\n4.  **Handoff**: On confirmation, publish the page and ask for approval.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have initialized the Task Journal with the plan and requirements: [URL]. Please review the context and acceptance criteria. Once you are ready for me to proceed, please reply with **APPROVED** or **LGTM** here in the chat.\"\n\n5.  **Wait**: STOP. Do not proceed until the user explicitly tells you to continue in the chat. Note: Do not rely on Draft page comments for approval on remote/public pages.\n\n## Phase 2: Execute (Action & Logging)\n\nOnce approved:\n\n1.  **Verify Approval**: Confirm the user has provided approval in the chat.\n2.  **Execute**: Perform the tasks outlined in the plan.\n3.  **Log Evidence**: For every significant action, append a concise, non-sensitive log entry to the Journal under a `# 📜 Execution Log` section. Do NOT include raw command output, file contents, or credentials.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF\n    ```\n\n## Phase 3: Verify (Result & Sign-off)\n\nOnce the execution is complete:\n\n1.  **Submit Results**: Append a `# ✅ Final Results` summary to the Journal. Include links to artifacts (e.g., PR URL, Draft page URL). Do not include raw file dumps.\n2.  **Confirm Before Publishing**: Explicitly confirm with the user before re-publishing.\n3.  **Handoff**: On confirmation, re-publish the page.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have completed the task. Please verify the results in the Task Journal: [URL]. If satisfied, reply with **DONE** or **✅** here in the chat.\"\n\n4.  **Wait**: STOP. If the user provides sign-off (**DONE** / **✅**), proceed to Phase 4. If feedback is received, enter the Iteration Loop.\n\n## Phase 4: Archive (Draft Page Only)\n\nAfter sign-off, append a final summary to the existing Task Journal page. This keeps all persistence within Draft — no local filesystem writes.\n\n```bash\ncat << 'EOF' | draft page append <id> --json\n# 🗂 Task Complete — Summary\n- **Outcome**: [Brief description of what was achieved]\n- **Key Decisions**: [Any notable trade-offs or design choices]\n- **Artifacts**: [Links to PR, relevant files, or external references]\nEOF\n```\n\n> The Draft page itself (with its page ID and URL) is the durable record. No additional writes to `TASK_LOG.md`, `knowledge/`, or other filesystem locations are required or expected.\n\n## Iteration Loop\n\nIf the user provides feedback or requests changes after Phase 3:\n1.  **Acknowledge**: Acknowledge the feedback in the chat.\n2.  **Start New Iteration**: Enter Phase 1 again to propose how you will address the feedback.\n3.  **Append to Same Page**: Do NOT create a new page. Append the new plan to the existing Task Journal under a new heading: `# 📋 Iteration [N]: Addressing Feedback`.\n4.  **Template**: Use the mandatory Phase 1 template for each new iteration to maintain context and traceability.\n\n## Non-Goals\n\n- Do NOT use `--mode workspace`.\n- Do NOT skip the plan approval gate.\n- Do NOT execute multiple un-logged steps.\n- Do NOT write to local agent filesystem (no `TASK_LOG.md`, no `knowledge/` writes).\n- Do NOT include credentials, PII, or sensitive command outputs in Draft page content.\n\nFile v1.5.10:_meta.json\n\n{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.5.10\",\n  \"publishedAt\": 1776469965325\n}\n\nArchive v1.5.9: 2 files, 3785 bytes\n\nFiles: SKILL.md (8021b), _meta.json (135b)\n\nFile v1.5.9:SKILL.md\n\n---\nname: draft-agent-loop\nversion: \"1.5.9\"\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the draft-cli skill. It runs draft-cli in local mode (indexDB-backed, no shared filesystem required), which enables page publishing without a workspace mount.\nmetadata:\n  clawdis:\n    emoji: \"🔄\"\n    dependencies:\n      - name: \"toliuweijing/draft-cli\"\n        type: \"other\"\n        url: \"https://clawhub.ai/toliuweijing/draft-cli\"\n    requires:\n      bins:\n        - \"draft\"\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This is an instruction-only skill. It has no install scripts, code files, or declared filesystem paths. All persistence is through Draft pages (via the `draft-cli` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about Draft CLI commands (use `draft-cli`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use `draft-cli` in local mode (`draft start-server --mode local`). Never use `--mode workspace`.\n- **Local mode** means Draft stores page data in indexDB (browser local storage) — it does not mount or access any shared filesystem.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensitive Data in Logs**: Do NOT include credentials, secrets, tokens, or PII in execution log entries or plan documents. Limit evidence to status indicators and non-sensitive file names.\n\n## Phase 0: Setup & Connection\n\nBefore doing anything, establish a stable Draft connection:\n\n```bash\n# 1. Start the daemon in local mode (indexDB-backed, no filesystem required)\ndraft start-server --mode local\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json\n```\n\nIf `draft status` does not show `READY`, follow the `draft-cli` connection-first recovery pattern:\n- `DAEMON_OFFLINE` → re-run `draft start-server --mode local`\n- `BROWSER_NOT_CONNECTED` → run `draft daemon` to pair a browser tab\n- Only proceed once `draft status --json` shows `\"state\": \"READY\"`\n\n## Phase 1: Plan (Proposal & Approval)\n\nBefore executing any code or changes:\n\n1.  **Create Journal**: Create a new Draft page titled `<Task Name> - Task Journal`.\n    ```bash\n    draft page create \"<Task Name> - Task Journal\" --json\n    ```\n2.  **Submit Plan**: Author a detailed Task Journal using the mandatory template. Append it to the Journal.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF\n    ```\n3.  **Confirm Before Publishing**: Before publishing, explicitly confirm with the user: \"I am about to publish the Task Journal for external review. Please confirm.\"\n4.  **Handoff**: On confirmation, publish the page and ask for approval.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have initialized the Task Journal with the plan and requirements: [URL]. Please review the context and acceptance criteria. Once you are ready for me to proceed, please reply with **APPROVED** or **LGTM** here in the chat.\"\n\n5.  **Wait**: STOP. Do not proceed until the user explicitly tells you to continue in the chat. Note: Do not rely on Draft page comments for approval on remote/public pages.\n\n## Phase 2: Execute (Action & Logging)\n\nOnce approved:\n\n1.  **Verify Approval**: Confirm the user has provided approval in the chat.\n2.  **Execute**: Perform the tasks outlined in the plan.\n3.  **Log Evidence**: For every significant action, append a concise, non-sensitive log entry to the Journal under a `# 📜 Execution Log` section. Do NOT include raw command output, file contents, or credentials.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF\n    ```\n\n## Phase 3: Verify (Result & Sign-off)\n\nOnce the execution is complete:\n\n1.  **Submit Results**: Append a `# ✅ Final Results` summary to the Journal. Include links to artifacts (e.g., PR URL, Draft page URL). Do not include raw file dumps.\n2.  **Confirm Before Publishing**: Explicitly confirm with the user before re-publishing.\n3.  **Handoff**: On confirmation, re-publish the page.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have completed the task. Please verify the results in the Task Journal: [URL]. If satisfied, reply with **DONE** or **✅** here in the chat.\"\n\n4.  **Wait**: STOP. If the user provides sign-off (**DONE** / **✅**), proceed to Phase 4. If feedback is received, enter the Iteration Loop.\n\n## Phase 4: Archive (Draft Page Only)\n\nAfter sign-off, append a final summary to the existing Task Journal page. This keeps all persistence within Draft — no local filesystem writes.\n\n```bash\ncat << 'EOF' | draft page append <id> --json\n# 🗂 Task Complete — Summary\n- **Outcome**: [Brief description of what was achieved]\n- **Key Decisions**: [Any notable trade-offs or design choices]\n- **Artifacts**: [Links to PR, relevant files, or external references]\nEOF\n```\n\n> The Draft page itself (with its page ID and URL) is the durable record. No additional writes to `TASK_LOG.md`, `knowledge/`, or other filesystem locations are required or expected.\n\n## Iteration Loop\n\nIf the user provides feedback or requests changes after Phase 3:\n1.  **Acknowledge**: Acknowledge the feedback in the chat.\n2.  **Start New Iteration**: Enter Phase 1 again to propose how you will address the feedback.\n3.  **Append to Same Page**: Do NOT create a new page. Append the new plan to the existing Task Journal under a new heading: `# 📋 Iteration [N]: Addressing Feedback`.\n4.  **Template**: Use the mandatory Phase 1 template for each new iteration to maintain context and traceability.\n\n## Non-Goals\n\n- Do NOT use `--mode workspace`.\n- Do NOT skip the plan approval gate.\n- Do NOT execute multiple un-logged steps.\n- Do NOT write to local agent filesystem (no `TASK_LOG.md`, no `knowledge/` writes).\n- Do NOT include credentials, PII, or sensitive command outputs in Draft page content.\n\nFile v1.5.9:_meta.json\n\n{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.5.9\",\n  \"publishedAt\": 1776469710759\n}\n\nArchive v1.5.8: 2 files, 3742 bytes\n\nFiles: SKILL.md (7879b), _meta.json (135b)\n\nFile v1.5.8:SKILL.md\n\n---\nname: draft-agent-loop\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the draft-cli skill. It runs draft-cli in local mode (indexDB-backed, no shared filesystem required), which enables page publishing without a workspace mount.\nmetadata: {\"clawdbot\":{\"emoji\":\"🔄\",\"requires\":{\"skills\":[\"draft-cli\"]}},\"version\":\"1.5.8\"}\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This is an instruction-only skill. It has no install scripts, code files, or declared filesystem paths. All persistence is through Draft pages (via the `draft-cli` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about Draft CLI commands (use `draft-cli`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use `draft-cli` in local mode (`draft start-server --mode local`). Never use `--mode workspace`.\n- **Local mode** means Draft stores page data in indexDB (browser local storage) — it does not mount or access any shared filesystem.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensitive Data in Logs**: Do NOT include credentials, secrets, tokens, or PII in execution log entries or plan documents. Limit evidence to status indicators and non-sensitive file names.\n\n## Phase 0: Setup & Connection\n\nBefore doing anything, establish a stable Draft connection:\n\n```bash\n# 1. Start the daemon in local mode (indexDB-backed, no filesystem required)\ndraft start-server --mode local\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json\n```\n\nIf `draft status` does not show `READY`, follow the `draft-cli` connection-first recovery pattern:\n- `DAEMON_OFFLINE` → re-run `draft start-server --mode local`\n- `BROWSER_NOT_CONNECTED` → run `draft daemon` to pair a browser tab\n- Only proceed once `draft status --json` shows `\"state\": \"READY\"`\n\n## Phase 1: Plan (Proposal & Approval)\n\nBefore executing any code or changes:\n\n1.  **Create Journal**: Create a new Draft page titled `<Task Name> - Task Journal`.\n    ```bash\n    draft page create \"<Task Name> - Task Journal\" --json\n    ```\n2.  **Submit Plan**: Author a detailed Task Journal using the mandatory template. Append it to the Journal.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF\n    ```\n3.  **Confirm Before Publishing**: Before publishing, explicitly confirm with the user: \"I am about to publish the Task Journal for external review. Please confirm.\"\n4.  **Handoff**: On confirmation, publish the page and ask for approval.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have initialized the Task Journal with the plan and requirements: [URL]. Please review the context and acceptance criteria. Once you are ready for me to proceed, please reply with **APPROVED** or **LGTM** here in the chat.\"\n\n5.  **Wait**: STOP. Do not proceed until the user explicitly tells you to continue in the chat. Note: Do not rely on Draft page comments for approval on remote/public pages.\n\n## Phase 2: Execute (Action & Logging)\n\nOnce approved:\n\n1.  **Verify Approval**: Confirm the user has provided approval in the chat.\n2.  **Execute**: Perform the tasks outlined in the plan.\n3.  **Log Evidence**: For every significant action, append a concise, non-sensitive log entry to the Journal under a `# 📜 Execution Log` section. Do NOT include raw command output, file contents, or credentials.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF\n    ```\n\n## Phase 3: Verify (Result & Sign-off)\n\nOnce the execution is complete:\n\n1.  **Submit Results**: Append a `# ✅ Final Results` summary to the Journal. Include links to artifacts (e.g., PR URL, Draft page URL). Do not include raw file dumps.\n2.  **Confirm Before Publishing**: Explicitly confirm with the user before re-publishing.\n3.  **Handoff**: On confirmation, re-publish the page.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have completed the task. Please verify the results in the Task Journal: [URL]. If satisfied, reply with **DONE** or **✅** here in the chat.\"\n\n4.  **Wait**: STOP. If the user provides sign-off (**DONE** / **✅**), proceed to Phase 4. If feedback is received, enter the Iteration Loop.\n\n## Phase 4: Archive (Draft Page Only)\n\nAfter sign-off, append a final summary to the existing Task Journal page. This keeps all persistence within Draft — no local filesystem writes.\n\n```bash\ncat << 'EOF' | draft page append <id> --json\n# 🗂 Task Complete — Summary\n- **Outcome**: [Brief description of what was achieved]\n- **Key Decisions**: [Any notable trade-offs or design choices]\n- **Artifacts**: [Links to PR, relevant files, or external references]\nEOF\n```\n\n> The Draft page itself (with its page ID and URL) is the durable record. No additional writes to `TASK_LOG.md`, `knowledge/`, or other filesystem locations are required or expected.\n\n## Iteration Loop\n\nIf the user provides feedback or requests changes after Phase 3:\n1.  **Acknowledge**: Acknowledge the feedback in the chat.\n2.  **Start New Iteration**: Enter Phase 1 again to propose how you will address the feedback.\n3.  **Append to Same Page**: Do NOT create a new page. Append the new plan to the existing Task Journal under a new heading: `# 📋 Iteration [N]: Addressing Feedback`.\n4.  **Template**: Use the mandatory Phase 1 template for each new iteration to maintain context and traceability.\n\n## Non-Goals\n\n- Do NOT use `--mode workspace`.\n- Do NOT skip the plan approval gate.\n- Do NOT execute multiple un-logged steps.\n- Do NOT write to local agent filesystem (no `TASK_LOG.md`, no `knowledge/` writes).\n- Do NOT include credentials, PII, or sensitive command outputs in Draft page content.\n\nFile v1.5.8:_meta.json\n\n{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.5.8\",\n  \"publishedAt\": 1776409945900\n}\n\nArchive v1.5.7: 2 files, 3926 bytes\n\nFiles: SKILL.md (8315b), _meta.json (135b)\n\nFile v1.5.7:SKILL.md\n\n---\nname: draft-agent-loop\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the draft-cli skill. It runs draft-cli in local mode (indexDB-backed, no shared filesystem required), which enables page publishing without a workspace mount.\nmetadata: {\"clawdbot\":{\"emoji\":\"🔄\",\"requires\":{\"skills\":[\"draft-cli\"]}},\"version\":\"1.5.7\"}\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This is an instruction-only skill. It has no install scripts, code files, or declared filesystem paths. All persistence is through Draft pages (via the `draft-cli` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about Draft CLI commands (use `draft-cli`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use `draft-cli` in local mode (`draft start-server --mode local`). Never use `--mode workspace`.\n- **Local mode** means Draft stores page data in indexDB (browser local storage) — it does not mount or access any shared filesystem.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensitive Data in Logs**: Do NOT include credentials, secrets, tokens, or PII in execution log entries or plan documents. Limit evidence to status indicators and non-sensitive file names.\n\n## Phase 0: Setup & Connection\n\nBefore doing anything, establish a stable Draft connection:\n\n```bash\n# 1. Start the daemon in local mode (indexDB-backed, no filesystem required)\ndraft start-server --mode local\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json\n```\n\nIf `draft status` does not show `READY`, follow the `draft-cli` connection-first recovery pattern:\n- `DAEMON_OFFLINE` → re-run `draft start-server --mode local`\n- `BROWSER_NOT_CONNECTED` → run `draft daemon` to pair a browser tab\n- Only proceed once `draft status --json` shows `\"state\": \"READY\"`\n\n## Phase 1: Plan (Proposal & Approval)\n\nBefore executing any code or changes:\n\n1.  **Create Journal**: Create a new Draft page titled `<Task Name> - Task Journal`.\n    ```bash\n    draft page create \"<Task Name> - Task Journal\" --json\n    ```\n2.  **Submit Plan**: Author a detailed Task Journal using the mandatory template. Append it to the Journal.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF\n    ```\n3.  **Confirm Before Publishing**: Before publishing, explicitly confirm with the user: \"I am about to publish the Task Journal for external review. Please confirm.\"\n4.  **Handoff**: On confirmation, publish the page (refer to the `draft-cli` skill for the canonical publish command and environment-specific requirements) and ask for approval.\n    **Handoff Phrase**: \"I have initialized the Task Journal with the plan and requirements: [URL]. Please review the context and acceptance criteria. Once you are ready for me to proceed, please reply with **APPROVED** or **LGTM** here in the chat.\"\n\n5.  **Wait**: STOP. Do not proceed until the user explicitly tells you to continue in the chat. Note: Do not rely on Draft page comments for approval on remote/public pages.\n\n## Phase 2: Execute (Action & Logging)\n\nOnce approved:\n\n1.  **Verify Approval**: Confirm the user has provided approval in the chat.\n2.  **Execute**: Perform the tasks outlined in the plan.\n    - **Boundaries**: Stay strictly within the scope of the approved plan. Do not access files, modify configurations, or utilize credentials outside the scope of the approved task.\n    - **Standards**: Adhere to the project's engineering standards, security mandates, and architectural patterns.\n    - **No Side Effects**: Avoid making changes that have unintended side effects outside the immediate task requirements.\n3.  **Log Evidence**: For every significant action, append a concise, non-sensitive log entry to the Journal under a `# 📜 Execution Log` section. Do NOT include raw command output, file contents, or credentials.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF\n    ```\n\n## Phase 3: Verify (Result & Sign-off)\n\nOnce the execution is complete:\n\n1.  **Submit Results**: Append a `# ✅ Final Results` summary to the Journal. Include links to artifacts (e.g., PR URL, Draft page URL). Do not include raw file dumps.\n2.  **Confirm Before Publishing**: Explicitly confirm with the user before re-publishing.\n3.  **Handoff**: On confirmation, re-publish the page (refer to the `draft-cli` skill for the canonical publish command).\n    **Handoff Phrase**: \"I have completed the task. Please verify the results in the Task Journal: [URL]. If satisfied, reply with **DONE** or **✅** here in the chat.\"\n\n4.  **Wait**: STOP. If the user provides sign-off (**DONE** / **✅**), proceed to Phase 4. If feedback is received, enter the Iteration Loop.\n\n## Phase 4: Archive (Draft Page Only)\n\nAfter sign-off, append a final summary to the existing Task Journal page. This keeps all persistence within Draft — no local filesystem writes.\n\n```bash\ncat << 'EOF' | draft page append <id> --json\n# 🗂 Task Complete — Summary\n- **Outcome**: [Brief description of what was achieved]\n- **Key Decisions**: [Any notable trade-offs or design choices]\n- **Artifacts**: [Links to PR, relevant files, or external references]\nEOF\n```\n\n> The Draft page itself (with its page ID and URL) is the durable record. No additional writes to `TASK_LOG.md`, `knowledge/`, or other filesystem locations are required or expected.\n\n## Iteration Loop\n\nIf the user provides feedback or requests changes after Phase 3:\n1.  **Acknowledge**: Acknowledge the feedback in the chat.\n2.  **Start New Iteration**: Enter Phase 1 again to propose how you will address the feedback.\n3.  **Append to Same Page**: Do NOT create a new page. Append the new plan to the existing Task Journal under a new heading: `# 📋 Iteration [N]: Addressing Feedback`.\n4.  **Template**: Use the mandatory Phase 1 template for each new iteration to maintain context and traceability.\n\n## Non-Goals\n\n- Do NOT use `--mode workspace`.\n- Do NOT skip the plan approval gate.\n- Do NOT execute multiple un-logged steps.\n- Do NOT write to local agent filesystem (no `TASK_LOG.md`, no `knowledge/` writes).\n- Do NOT include credentials, PII, or sensitive command outputs in Draft page content.\n\nFile v1.5.7:_meta.json\n\n{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.5.7\",\n  \"publishedAt\": 1776340749371\n}\n\nArchive v1.5.6: 2 files, 3742 bytes\n\nFiles: SKILL.md (7879b), _meta.json (135b)\n\nFile v1.5.6:SKILL.md\n\n---\nname: draft-agent-loop\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the draft-cli skill. It runs draft-cli in local mode (indexDB-backed, no shared filesystem required), which enables page publishing without a workspace mount.\nmetadata: {\"clawdbot\":{\"emoji\":\"🔄\",\"requires\":{\"skills\":[\"draft-cli\"]}},\"version\":\"1.5.6\"}\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This is an instruction-only skill. It has no install scripts, code files, or declared filesystem paths. All persistence is through Draft pages (via the `draft-cli` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about Draft CLI commands (use `draft-cli`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use `draft-cli` in local mode (`draft start-server --mode local`). Never use `--mode workspace`.\n- **Local mode** means Draft stores page data in indexDB (browser local storage) — it does not mount or access any shared filesystem.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensitive Data in Logs**: Do NOT include credentials, secrets, tokens, or PII in execution log entries or plan documents. Limit evidence to status indicators and non-sensitive file names.\n\n## Phase 0: Setup & Connection\n\nBefore doing anything, establish a stable Draft connection:\n\n```bash\n# 1. Start the daemon in local mode (indexDB-backed, no filesystem required)\ndraft start-server --mode local\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json\n```\n\nIf `draft status` does not show `READY`, follow the `draft-cli` connection-first recovery pattern:\n- `DAEMON_OFFLINE` → re-run `draft start-server --mode local`\n- `BROWSER_NOT_CONNECTED` → run `draft daemon` to pair a browser tab\n- Only proceed once `draft status --json` shows `\"state\": \"READY\"`\n\n## Phase 1: Plan (Proposal & Approval)\n\nBefore executing any code or changes:\n\n1.  **Create Journal**: Create a new Draft page titled `<Task Name> - Task Journal`.\n    ```bash\n    draft page create \"<Task Name> - Task Journal\" --json\n    ```\n2.  **Submit Plan**: Author a detailed Task Journal using the mandatory template. Append it to the Journal.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF\n    ```\n3.  **Confirm Before Publishing**: Before publishing, explicitly confirm with the user: \"I am about to publish the Task Journal for external review. Please confirm.\"\n4.  **Handoff**: On confirmation, publish the page and ask for approval.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have initialized the Task Journal with the plan and requirements: [URL]. Please review the context and acceptance criteria. Once you are ready for me to proceed, please reply with **APPROVED** or **LGTM** here in the chat.\"\n\n5.  **Wait**: STOP. Do not proceed until the user explicitly tells you to continue in the chat. Note: Do not rely on Draft page comments for approval on remote/public pages.\n\n## Phase 2: Execute (Action & Logging)\n\nOnce approved:\n\n1.  **Verify Approval**: Confirm the user has provided approval in the chat.\n2.  **Execute**: Perform the tasks outlined in the plan.\n3.  **Log Evidence**: For every significant action, append a concise, non-sensitive log entry to the Journal under a `# 📜 Execution Log` section. Do NOT include raw command output, file contents, or credentials.\n    ```bash\n    cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF\n    ```\n\n## Phase 3: Verify (Result & Sign-off)\n\nOnce the execution is complete:\n\n1.  **Submit Results**: Append a `# ✅ Final Results` summary to the Journal. Include links to artifacts (e.g., PR URL, Draft page URL). Do not include raw file dumps.\n2.  **Confirm Before Publishing**: Explicitly confirm with the user before re-publishing.\n3.  **Handoff**: On confirmation, re-publish the page.\n    ```bash\n    draft page publish <id> --invite-code innosage --json\n    ```\n    **Handoff Phrase**: \"I have completed the task. Please verify the results in the Task Journal: [URL]. If satisfied, reply with **DONE** or **✅** here in the chat.\"\n\n4.  **Wait**: STOP. If the user provides sign-off (**DONE** / **✅**), proceed to Phase 4. If feedback is received, enter the Iteration Loop.\n\n## Phase 4: Archive (Draft Page Only)\n\nAfter sign-off, append a final summary to the existing Task Journal page. This keeps all persistence within Draft — no local filesystem writes.\n\n```bash\ncat << 'EOF' | draft page append <id> --json\n# 🗂 Task Complete — Summary\n- **Outcome**: [Brief description of what was achieved]\n- **Key Decisions**: [Any notable trade-offs or design choices]\n- **Artifacts**: [Links to PR, relevant files, or external references]\nEOF\n```\n\n> The Draft page itself (with its page ID and URL) is the durable record. No additional writes to `TASK_LOG.md`, `knowledge/`, or other filesystem locations are required or expected.\n\n## Iteration Loop\n\nIf the user provides feedback or requests changes after Phase 3:\n1.  **Acknowledge**: Acknowledge the feedback in the chat.\n2.  **Start New Iteration**: Enter Phase 1 again to propose how you will address the feedback.\n3.  **Append to Same Page**: Do NOT create a new page. Append the new plan to the existing Task Journal under a new heading: `# 📋 Iteration [N]: Addressing Feedback`.\n4.  **Template**: Use the mandatory Phase 1 template for each new iteration to maintain context and traceability.\n\n## Non-Goals\n\n- Do NOT use `--mode workspace`.\n- Do NOT skip the plan approval gate.\n- Do NOT execute multiple un-logged steps.\n- Do NOT write to local agent filesystem (no `TASK_LOG.md`, no `knowledge/` writes).\n- Do NOT include credentials, PII, or sensitive command outputs in Draft page content.\n\nFile v1.5.6:_meta.json\n\n{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.5.6\",\n  \"publishedAt\": 1776339605529\n}","readmeExcerpt":"Skill: Draft Agent Loop Owner: toliuweijing Summary: Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents. Use this skill when the user wants structured oversight over an agent task: plan appro... Tags: latest:1.6.0 Version history: v1.6.0 | 2026-04-21T06:57:49.549Z | auto **Dependency change for compatibility and consolidation.** - Replaced draft-headless-pages dependency with the canonical draft-cl","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"# 1. Start the daemon in headless runtime v2\ndraft start-server\n\n# 2. Confirm the session is READY before proceeding\ndraft status --json"},{"language":"bash","snippet":"draft page create \"<Task Name> - Task Journal\" --json"},{"language":"bash","snippet":"cat << 'EOF' | draft page append <id> --json\n    # 📋 Task: [Title]\n\n    ## Context\n    [Detailed background and motivation]\n\n    ## Problem / Goal\n    [Specific issue being solved or feature being added]\n\n    ## Acceptance Criteria (Outcome-Focused)\n    - [ ] [Criterion 1]\n    - [ ] [Criterion 2]\n\n    ## Implementation Notes\n    [Current state analysis, relevant files, suggested approach, technical considerations]\n\n    ## Test Coverage\n    [Test strategy, scenarios to test, existing tests to reference]\n    EOF"},{"language":"bash","snippet":"draft page publish <id> --invite-code \"${GLOBAL_INVITE_CODE:-innosage}\" --json"},{"language":"bash","snippet":"cat << 'EOF' | draft page append <id> --json\n    ### [Timestamp] Action: [Description]\n    - **Status**: Success/Failure\n    - **Evidence**: [e.g., \"Modified src/components/Button.tsx — added reveal prop\"]\n    EOF"},{"language":"bash","snippet":"draft page publish <id> --invite-code \"${GLOBAL_INVITE_CODE:-innosage}\" --json"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: draft-agent-loop\nversion: \"1.6.0\"\ndescription: >\n  Enforce a Human-in-the-Right-Loop (HITRL) lifecycle for remote agents.\n  Use this skill when the user wants structured oversight over an agent task: plan approval before execution, evidence-logged execution, and result sign-off before closure.\n  Trigger phrases: \"work on this with my oversight\", \"check with me before you start\", \"use HITRL for this\", \"I want to review your plan first\", \"use draft-agent-loop\".\n  DO NOT use for tasks where the user simply asks to do something without requesting approval gates. Use draft-cli for raw Draft commands.\n  This skill depends on the canonical draft-cli skill. It assumes headless page workflows under `draft ... --runtime v2`, which fit remote OpenClaw-style isolated environments.\nmetadata:\n  clawdis:\n    emoji: \"🔄\"\n    dependencies:\n      - name: \"toliuweijing/draft-cli\"\n        type: \"other\"\n        url: \"https://clawhub.ai/toliuweijing/draft-cli\"\n    requires:\n      bins:\n        - \"draft\"\n    install:\n      - id: \"npm\"\n        kind: \"node\"\n        package: \"@innosage/draft-cli\"\n        bins:\n          - \"draft\"\n        label: \"Install draft-cli (npm)\"\n    envVars:\n      - name: \"GLOBAL_INVITE_CODE\"\n        required: false\n        description: \"The invite code used to publish Draft pages safely. Defaults to `innosage` during the free beta publish flow.\"\n---\n\n# Draft Agent Loop Skill (HITRL)\n\nUse this skill to implement a rigorous human-agent collaboration loop. This is the \"Human-in-the-Right-Loop\" (HITRL) method, designed to eliminate \"blind box\" agent outcomes by forcing plan approval and result verification.\n\n> **Scope**: This skill orchestrates remote agent workflows using the `draft` CLI. All persistence is through Draft pages (via the canonical `draft-cli` dependency). It does not write to local disk or agent memory.\n\n## Trigger Guidance\n\nTrigger this skill when:\n\n- \"Work on this task and check with me before and after.\"\n- \"I want to review your plan first before you do anything.\"\n- \"Use HITRL / use draft-agent-loop for this.\"\n- \"Apply structured oversight to this task.\"\n- New task received where the user's intent is high-stakes or complex enough to warrant human gates.\n- A new iteration is requested after a Phase 3 sign-off.\n\nDo NOT trigger this skill when:\n\n- The user asks to do a task directly with no mention of approval or review gates.\n- The user only asks about raw Draft commands or page automation without approval gates (use `draft-cli`).\n- The user wants a local-file authoring workflow (authorship in local markdown).\n\n## Core Rules\n\n- **Source of Truth**: The \"Task Journal\" Draft page. All plans, logs, and results live there.\n- **Environment**: Always use headless page mode through `draft ... --runtime v2`.\n- **Runtime dependency**: Follow the startup and page-operation rules from `draft-cli`.\n- **Handoff Mode**: **Blocking**. STOP and wait for human approval/sign-off in the chat before proceeding to the next phase.\n- **No Sensiti"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn756a13aw1mqmzdr452d1z6xx82qdga\",\n  \"slug\": \"draft-agent-loop\",\n  \"version\": \"1.6.0\",\n  \"publishedAt\": 1776754669549\n}"},{"path":"skill-card.md","content":"## Description:\n\nEnforces a Human-in-the-Right-Loop lifecycle for remote agent tasks with plan approval, evidence-logged execution, and result sign-off gates.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[toliuweijing](https://clawhub.ai/user/toliuweijing)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and agent operators use this skill when they need structured human oversight for remote agent work, including approval before execution and explicit sign-off before task closure.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Task journals are persisted in Draft pages and may be published for review.\n\nMitigation: Avoid including secrets, tokens, sensitive personal data, or raw command output in plans, logs, and result summaries.\n\nRisk: The skill depends on an external, unpinned draft-cli installation.\n\nMitigation: Use a pinned or otherwise verified draft-cli dependency in higher-risk environments.\n\nRisk: Approval gates can be bypassed if the agent proceeds without explicit chat confirmation.\n\nMitigation: Require approval and sign-off phrases in chat before moving between planning, execution, and closure phases.\n\n## Reference(s):\n\n- [Draft Agent Loop on ClawHub](https://clawhub.ai/toliuweijing/skills/draft-agent-loop)\n- [draft-cli dependency on ClawHub](https://clawhub.ai/toliuweijing/draft-cli)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, Shell commands, Configuration, Guidance]\n\n**Output Format:** [Markdown guidance with inline shell commands and task-journal templates]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Requires the draft CLI and may use GLOBAL_INVITE_CODE for publishing Draft pages.]\n\n## Skill Version(s):\n\n1.6.0 (source: release evidence and skill frontmatter)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment."}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":1552,"uniquenessScore":41,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-11T23:17:56.656Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-11T23:17:56.656Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-13T04:40:27.572Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}