| name | manus-loop-legal |
| description | Legal-document-specialized variant of the manus-loop multi-stage drafting workflow. Use this skill whenever the user asks for a contract, supplemental agreement, lease, NDA, employment agreement, sales contract, legal memo, brief, opinion letter, or similar formal legal deliverable — especially in Chinese (中文合同、补充协议、法律意见书). Trigger even when the user does not explicitly request a multi-stage process; legal documents have strict structural and defensive-language conventions that single-pass drafts routinely violate. For non-legal structured deliverables (research reports, business documents, technical specs), use the general manus-loop skill instead. Do NOT trigger for short emails, simple Q&A, code snippets, conversational answers, or anything under 300 words. |
manus-loop-legal
A multi-stage drafting workflow modeled on the Manus AI agent's planner→knowledge→executor loop. The whole point: substantial deliverables are produced far better in 4-5 focused passes than in a single shot. This skill forces those passes.
Why this exists
A single-pass LLM draft of a formal document tends to:
- Skip structural conventions (e.g. for a 中文补充合同, omitting the standard "原合同效力及补充关系" first clause)
- Use prose where tables would be clearer (rent schedules, date schedules, party comparison)
- Hardcode values the user never specified (a deposit amount, an effective date)
- Forget defensive hedging ("以双方最终书面确认为准")
- Mirror the original document's structure too literally instead of restructuring for the new purpose
The Manus pattern fixes this by separating planning from knowledge retrieval from execution from review — each phase has a focused goal and doesn't compete with the others for attention. This skill replicates that pattern.
Two modes — pick one before starting
Mode A: in-session sequential (default). I play all four roles myself, one after another, with explicit file handoffs. No API key needed. Works in every Claude environment.
Mode B: parallel multi-agent via API. If ANTHROPIC_API_KEY is set in the environment, I spawn real subprocess Claude instances for each role using scripts/orchestrate.py. Faster on long documents (planner + knowledge run in parallel) and more rigorous (each subagent has only its own system prompt, no role-contamination).
Check for API key first:
test -n "$ANTHROPIC_API_KEY" && echo "MODE B available" || echo "MODE A only"
State the mode to the user before starting. If you choose Mode B, run python scripts/orchestrate.py --help to see options.
The loop (both modes follow this)
Work in a dedicated workspace, e.g. /home/claude/manus-work/<task-slug>/. Every phase writes a file; the next phase reads it. This is non-negotiable — file-based handoff is what enforces phase separation.
workspace/
├── todo.md ← live checklist, updated as you go
├── plan.md ← Phase 1 output: structure decomposition
├── knowledge.md ← Phase 2 output: domain conventions retrieved
├── draft.md ← Phase 3 output: full draft
├── review.md ← Phase 4 output: issues found
└── final.<ext> ← Phase 5 output: refined deliverable
Phase 0: triage (~30 seconds)
Decide: does this task actually need the loop? If yes, identify the deliverable type — this determines which reference file to load in Phase 2.
Deliverable types this skill handles:
chinese-legal-contract — 中文合同、补充协议、租赁、买卖、劳动、保密、服务等
english-legal-contract — English contracts, amendments, NDAs, MSAs
chinese-legal-memo — 中文法律意见书、法律备忘录
english-legal-memo — English legal memos, opinion letters, briefs
For non-legal structured deliverables (research reports, business plans, technical specs), use the general manus-loop skill — this legal-specialized variant has heavier domain conventions baked in that aren't appropriate for non-legal work.
Phase 1: Plan (planner role)
Read all user-provided context (uploaded files, prior conversation). Produce plan.md with:
- Deliverable type and rationale (one line)
- Numbered structural outline of the final document — section names and one-line purpose for each. Use the target document's conventional structure, not the source document's.
- List of facts/values the user explicitly provided that must appear in the output
- List of facts/values the user did NOT provide that the draft should leave as placeholders rather than invent
- Known risk areas — places where a single-pass draft would likely overstep, mirror source structure, or skip conventions
Do not draft any actual content in this phase. The output is structure and constraints only.
Phase 2: Retrieve knowledge (knowledge role)
Look at plan.md. The orchestrator will look up references/<deliverable-type>.md by deliverable type (slug-matched). Available references in this legal-specialized skill:
references/chinese-legal-contract.md — 中文合同、补充协议、租赁、买卖、劳动等
references/english-legal-contract.md — English contracts, amendments, NDAs, MSAs
references/meta-principles.md — universal fallback (inherited from base manus-loop)
If a needed reference doesn't exist (e.g., for legal memos or briefs), meta-principles.md will be used as fallback. Note the gap in your delivery message so the user can decide whether to add a domain-specific reference.
Then write knowledge.md containing:
- Mandatory structural elements for this deliverable type (e.g. for a 中文补充合同: 必须含"原合同效力及补充关系"作为第一条)
- Tabular zones — which parts of this specific document should be tables (e.g. rent schedules → table)
- Placeholder rules — which fields must be left as ____ rather than invented
- Hedging language library — relevant defensive clauses to include
- Non-overstepping list — items the user didn't ask about that the draft must NOT silently decide
The reference files contain the general patterns; knowledge.md is the task-specific filtered version — only the rules that apply to this particular document. Don't dump the whole reference file.
Phase 3: Draft (executor role)
Read plan.md AND knowledge.md together. Now write draft.md.
Hard rules during drafting:
- Every section listed in
plan.md step 2 appears, in that order
- Every "tabular zone" from
knowledge.md step 2 renders as a Markdown table
- Every placeholder rule from
knowledge.md step 3 is honored — use ____ not invented values
- Every relevant hedging clause from
knowledge.md step 4 is woven in where appropriate
- Nothing from "non-overstepping list" appears as a unilateral decision
Generate the full draft in one pass once these constraints are loaded. The constraints do the work of keeping you on track.
Phase 4: Review (reviewer role)
Read draft.md, plan.md, knowledge.md. Adopt an adversarial mindset — you are not the drafter, you are someone hired to find what the drafter missed. Write review.md with:
- Structural compliance — did every mandatory element appear? Check
knowledge.md step 1.
- Table compliance — was each tabular zone actually rendered as a table? Check
knowledge.md step 2.
- Placeholder compliance — were any invented values smuggled in? Check
knowledge.md step 3.
- Hedging compliance — are the defensive clauses present and well-placed?
- Overstepping audit — did the draft silently decide anything from the non-overstepping list?
- Source-mirror audit — did the draft accidentally mirror the source document's structure when the target type calls for a different one?
- Calculation check — re-derive every numeric value in the draft from the user-provided inputs. Note any mismatch.
- Risk areas flagged in
plan.md step 5 — were they handled correctly?
For each issue, write: [Severity: high/med/low] Section X.Y: <problem> → <suggested fix>. If everything passes, write "No issues found" and skip Phase 5.
Phase 5: Refine (executor role, again)
Read draft.md + review.md. Apply every high/medium severity fix. Optionally apply low. Write final.md (or for .docx/.pptx output, generate the final file format using the appropriate document skill: /mnt/skills/public/docx/SKILL.md etc.).
For low-severity issues you chose to skip, note them briefly when delivering to the user so they can decide.
Phase 6: Deliver
Call present_files on the final deliverable (and optionally on the workspace files if the user might want to see the planning trail). In your message:
- One-sentence summary of what was produced
- Any low-severity issues from Phase 4 that you chose to skip
- Any places where you left placeholders the user must fill
- Any places where you made a judgment call the user should review
Do not pad the message with summary of the document's contents — the user can read the file.
todo.md discipline
Create todo.md at the start of Phase 1. Update it after each phase. Format:
# Task: <one-line description>
# Mode: A (in-session) | B (multi-agent)
# Deliverable type: <type>
- [x] Phase 0: triage — deliverable type identified
- [x] Phase 1: plan.md written
- [ ] Phase 2: knowledge.md written
- [ ] Phase 3: draft.md written
- [ ] Phase 4: review.md written
- [ ] Phase 5: final.<ext> written
- [ ] Phase 6: delivered to user
## Notes
<running notes, decisions, things to remember>
The discipline matters: if you're not updating todo.md, you've already drifted from the loop.
Mode B specifics — parallel multi-agent
When ANTHROPIC_API_KEY is set, prefer Mode B. Usage:
python scripts/orchestrate.py \
--task "<one-line task description>" \
--context-files "/path/to/uploaded.pdf,/path/to/notes.md" \
--user-requirements "<the user's specific asks>" \
--workspace /home/claude/manus-work/<slug> \
--deliverable-type chinese-legal-contract
orchestrate.py runs:
- Planner subagent (claude-opus-4-5 or sonnet, focused system prompt from
scripts/prompts/planner.txt)
- Knowledge subagent — loads the right reference file, returns task-specific filtered rules
- Executor subagent — gets plan + knowledge, drafts
- Reviewer subagent — gets draft + plan + knowledge, finds issues
- Executor subagent (round 2) — applies fixes
Planner and knowledge can run in parallel because knowledge only needs the deliverable type from planner's first line — the script handles this scheduling. Total wall time on a medium document: ~60-90s.
If the script fails (no key, rate limit, network), fall back to Mode A automatically.
When NOT to use this skill
- Conversational answers, short emails, quick summaries
- Code snippets or single-file scripts
- Anything <300 words of expected output
- When the user explicitly says "just give me a quick draft" or similar
- When the task is purely creative writing (poetry, fiction) where the structure isn't pre-determined by domain conventions
For these cases, answer normally without the loop.
Reference files
references/chinese-legal-contract.md — 中文合同/补充协议起草规范、表格使用、占位符、兜底语句库(核心参考,228 行)
references/english-legal-contract.md — English contract and amendment drafting conventions
references/meta-principles.md — universal patterns inherited from base manus-loop (fallback for non-contract legal work)
The legal-specific files are large and detailed because legal drafting has dense conventions. The knowledge subagent filters them to extract only what applies to the current task — don't dump the whole file into knowledge.md.
Scripts
scripts/orchestrate.py — Mode B orchestrator (Anthropic API)
scripts/prompts/planner.txt — planner subagent system prompt
scripts/prompts/knowledge.txt — knowledge subagent system prompt
scripts/prompts/executor.txt — executor subagent system prompt
scripts/prompts/reviewer.txt — reviewer subagent system prompt
Assets
assets/todo-template.md — copy-paste starting point for todo.md
assets/plan-template.md — copy-paste starting point for plan.md