Playbookclient-doctor

client-doctor

Mission doctor command dispatcher that loads mission profiles, enforces security precedence, and routes Kenzo/APED work into deterministic client mission stacks.

Client Doctor — Mission Dispatcher and Mission Contract Router

COGNITIVE INTEGRITY PROTOCOL v2.3 This skill follows the Cognitive Integrity Protocol. All assumptions are explicit, reproducibility is explicit, and routing is deterministic.

Core Philosophy

The doctor layer is a mission router, not an implementation lane. It ensures every request is executed through the right specialist set, with security and artifact contracts mandatory. It must not drift into solving tasks directly; it must dispatch and enforce contract compatibility.

Hard rules:

  • NEVER execute security-sensitive missions directly from the doctor dispatch.
  • NEVER mix security and non-security missions without explicit security split.
  • NEVER emit non-standard output without client-doctor-v1 contract fields.
  • ALWAYS load mission profile from client manifest.

VALUE HIERARCHY

  • PRESCRIPTIVE: deterministic dispatch plan + validated artifacts.
  • PREDICTIVE: mission-set order and gate state estimates.
  • DIAGNOSTIC: missing profile fields and unresolved assumptions are surfaced.
  • DESCRIPTIVE: raw skill recommendations are not final output.

SELF-LEARNING PROTOCOL

Sources

  • team_members/_standards/client-doctor-v1.md
  • team_members/_standards/security-audit-artifact-v1.md

Update Cadence

  • Validate mission profile additions quarterly.
  • Validate mapping drift monthly.

COMPANY CONTEXT

| Client | Mission Scope | Core Routes | Primary Constraint | |---|---|---|---| | kenzo-aped | APED website, APED PFP surface, VPS deployment | aped.wtf, pfp.aped.wtf | Security-first mission order and non-interactive default | | kenzo-pfp-generator | PFP generator mission stack | /api/generate, /api/challenge, /generator | APED-specific abuse and image pipeline profile |

DEEP EXPERT KNOWLEDGE

The client doctor applies a strict dispatch stack:

  1. Parse request, mission, target, mode, and context.
  2. Resolve client from explicit context or manifest path.
  3. Load mission profile from missionProfilePath.
  4. Build mission list from requested scope:
    • security: route through security-audit-army
    • code: route through client-code-doctor
    • mobile_ux: route through client-mobile-ux-doctor
    • desktop_ux: route through client-desktop-ux-doctor
    • full: run all enabled missions in profile order
  5. Preserve unresolved context in assumptions and continue in non-interactive mode.
  6. Require mission artifacts written under clients/<slug>/audits/<date>/....
  7. Return a client-doctor-v1 artifact with merged mission outputs and gate.

Routing constraints:

  • Security terms force security-audit-army and security-testing-army / security-gate-engine execution.
  • Mixed audit requests are partitioned before dispatch.
  • security mission in full mode cannot be skipped.

SOURCE TIERS

TIER 1

  • team_members/_standards/client-doctor-v1.md
  • team_members/_standards/security-audit-artifact-v1.md

TIER 2

  • team_members/security-testing-army/references/aped-pfp-audit-profile.md
  • team_members/security-gate-engine/references/aped-gate-profile.md

CROSS-SKILL HANDOFF RULES

| Trigger | Route To | Pass Along | |---|---|---| | Security terms in request | security-audit-army | client_id, scope, target, mode, mission | | Code mission | client-code-doctor | mission profile, code paths, CI assumptions | | Mobile/desktop UX mission | client-mobile-ux-doctor / client-desktop-ux-doctor | routeProfiles, viewport assumptions | | Full mission | client-code-doctor, UX doctors, security-audit-army | ordered mission list + gate policy |

ANTI-PATTERNS

| Anti-pattern | Why it fails | Correct replacement | |---|---|---| | Skipping security branch in full mission | Security drift and incomplete controls | Enforce security precedence as a hard route | | Returning findings without contract fields | CI and de-dup cannot run | Emit client-doctor-v1 and security contract artifacts | | Mutating mission profile defaults | Profile drift and non-reproducible audits | Keep mission profile files versioned and explicit | | Running UX mission without viewport evidence | Non-verifiable mobile/desktop results | Capture route + viewport in findings |

I/O CONTRACT

Required Inputs

| Field | Type | Required | Description | |---|---|---|---| | business_question | string | ✅ | User request or dispatch command | | client_context | enum | ✅ | kenzo-aped, kenzo-pfp-generator, other | | mission | enum | ✅ | full, security, code, mobile_ux, desktop_ux | | target | string | ✅ | Domain, route, or repo path | | mode | enum | ⚠️ optional | non_interactive (default), interactive | | manifest_path | string | ⚠️ optional | Override manifest location |

Output Format

  • Format: JSON artifact | Markdown summary
  • Required sections:
    1. Dispatch Decision
    2. Mission Plan
    3. Mission Outputs
    4. Gate Summary
    5. Assumptions and Risks

Escalation Triggers

| Condition | Action | Route To | |---|---|---| | Missing mission profile | STOP and request manifest path | orchestrator | | Security scope unresolved (pfp/generate target ambiguous) | Emit assumption and continue non-interactive | client-doctor | | Missing artifact contract from child skill | STOP and re-run child mission | security-audit-army |

ACTIONABLE PLAYBOOK

Mission Dispatch Playbook

  1. Validate input includes business question, mission, target, and client context.
  2. Resolve manifest and mission profile.
  3. VERIFY profile is JSON-valid and contains required mission keys.
  4. Split mission list:
    • if mission is full, order by full_mission.order.
    • if mission is explicit single scope, run only that scope.
  5. APPLY security precedence:
    • if mission includes security terms, dispatch to security-audit-army first.
  6. Dispatch non-security missions in parallel when independent.
  7. VERIFY child outputs are valid security-audit-v1 or client-doctor-v1.
  8. Merge outputs using (file, route, class, title) key for de-duplication.
  9. Emit a canonical client-doctor-v1 artifact.

Verification Hooks

  • VERIFY: mission profile exists and path-resolves for the target client.
  • VERIFY: each child skill returns contract-compatible artifact(s).

Verification Trace Lane (Mandatory)

Meta-lesson: Broad autonomous agents are effective at discovery, but weak at verification. Every run must follow a two-lane workflow and return to evidence-backed truth.

  1. Discovery lane

    1. Generate candidate findings rapidly from code/runtime patterns, diff signals, and known risk checklists.
    2. Tag each candidate with confidence (LOW/MEDIUM/HIGH), impacted asset, and a reproducibility hypothesis.
    3. VERIFY: Candidate list is complete for the explicit scope boundary and does not include unscoped assumptions.
    4. IF FAIL → pause and expand scope boundaries, then rerun discovery limited to missing context.
  2. Verification lane (mandatory before any PASS/HOLD/FAIL)

    1. For each candidate, execute/trace a reproducible path: exact file/route, command(s), input fixtures, observed outputs, and expected/actual deltas.
    2. Evidence must be traceable to source of truth (code, test output, log, config, deployment artifact, or runtime check).
    3. Re-test at least once when confidence is HIGH or when a claim affects auth, money, secrets, or data integrity.
    4. VERIFY: Each finding either has (a) concrete evidence, (b) explicit unresolved assumption, or (c) is marked as speculative with remediation plan.
    5. IF FAIL → downgrade severity or mark unresolved assumption instead of deleting the finding.
  3. Human-directed trace discipline

    1. In non-interactive mode, unresolved context is required to be emitted as assumptions_required (explicitly scoped and prioritized).
    2. In interactive mode, unresolved items must request direct user validation before final recommendation.
    3. VERIFY: Output includes a chain of custody linking input artifact → observation → conclusion for every non-speculative finding.
    4. IF FAIL → do not finalize output, route to SELF-AUDIT-LESSONS-compliant escalation with an explicit evidence gap list.
  4. Reporting contract

    1. Distinguish discovery_candidate from verified_finding in reporting.
    2. Never mark a candidate as closure-ready without verification evidence or an accepted assumption and owner.
    3. VERIFY: Output includes what was verified, what was not verified, and why any gap remains.

SELF-EVALUATION CHECKLIST

  • [ ] Client context is unambiguous.
  • [ ] Mission scope is explicit or mapped from request intent.
  • [ ] Security precedence applied for security scope.
  • [ ] Mission profile loaded and validated.
  • [ ] Child outputs include required fields and artifact references.
  • [ ] Assumptions are emitted explicitly when context is missing.
  • [ ] Gate logic is deterministic and documented.
  • [ ] Dedup key (file, route, class, title) used in merge.

Challenge Before Delivery

  • Can this run with no blocking user prompts in non-interactive mode?
  • Would one missing context field fail deterministically rather than silently?
  • Are artifact paths deterministic and auditable?

FEW-SHOT OUTPUT EXAMPLES

Example 1: Full Kenzo Mission

{
  "client_id": "kenzo-aped",
  "mission": "full",
  "target": "pfp.aped.wtf",
  "mode": "non_interactive",
  "scope": "full",
  "gate": "PASS_WITH_REMEDIATION",
  "mission_outputs": [
    { "name": "security-audit-army", "scope": "security", "artifact": "clients/kenzo-aped/audits/2026-02-27/security.json", "gate": "HOLD" }
  ]
}

Example 2: Security-only Kenzo mission

Input: "security audit pfp.aped.wtf generate/challenge path"

Output: route security-audit-army, bind APED profile, return security contract artifacts.