Skip to content

Add orchestrator Phase 0: file formats, system prompt, and agent definition#1

Open
davemeng wants to merge 3 commits into
masterfrom
claude/cross-project-orchestrator-sU9wv
Open

Add orchestrator Phase 0: file formats, system prompt, and agent definition#1
davemeng wants to merge 3 commits into
masterfrom
claude/cross-project-orchestrator-sU9wv

Conversation

@davemeng
Copy link
Copy Markdown
Owner

Summary

This PR introduces the foundational specification and configuration for the cross-project orchestrator — an always-on agent that routes incoming emails, WhatsApp messages, and Plaud meeting transcripts to relevant client engagements and either acts autonomously on low-risk items or stages proposals for approval.

This is Phase 0 of the rollout: the buildable artifacts needed before the Managed Agent (Phase 1) and ingress (Phase 2) can be implemented.

Key changes

  • FORMATS.md — Complete specification of all on-disk file formats within each Clients/<X>/ folder:

    • Deterministic id derivation (dedupe key based on SHA256 of channel + provider message ID)
    • inbox/<ts>-<id>.md — incoming items with full classification metadata
    • pending-approval/<id>.md — drafts awaiting sign-off (replies, meeting followups, config proposals)
    • outbox/<id>.md — audit copies of sent messages with loop-prevention keys
    • decisions/<date>-<slug>.md — append-only ledger of actions taken and reasoning
    • meetings/<date>-<slug>.md — Plaud transcripts with extracted decisions and action items
    • feedback/<id>.json — labeled corrections for the learning loop
    • examples/<slug>.md — curated (situation → ideal reply) pairs for in-context retrieval
  • system-prompt.md — Complete system prompt for the Managed Agent covering:

    • Four modes: process (new inbound), approve (sign-off), reject (decline), reflect (weekly learning)
    • I/O efficiency rules: tiered reads, parallelization, deduplication, batching
    • Risk classification logic (deferred to global-playbook.md to avoid duplication)
    • Routing (rule-based via routing.yaml or classifier fallback)
    • Auto-send thresholds and staging logic
    • Completion contract (JSON schema for all return values)
  • agent.yaml — Portable Managed Agent definition:

    • Model: Claude Sonnet 4.6 (quality drafts, cost-effective classification)
    • MCP servers: Google Drive (state substrate), Gmail (read/send), whatsmeow (Phase 4)
    • Input schema (mode, item_id, channel, sender, subject, snippet, routing_hint, etc.)
    • Completion schema (action, risk, pending_ref, outbox_ref, human_summary)
    • Success rubric for each mode
    • Soft I/O targets (max reads/writes, latency)
  • global-playbook.md — Cross-client rules (single source of truth):

    • Risk classification rule: forced HIGH (always-material categories), LOW (routine), MED (default)
    • Always-material categories: price/fees, scope/timeline, contract terms, cap table, people, counterparty legal, external commitments
    • Tone defaults (professional, concise, no over-apologizing)
  • routing.example.yaml — Routing + risk config schema with examples:

    • Per-client email/domain/phone/Plaud patterns
    • Risk thresholds (low/med/high) gating auto-send
    • Global token caps and spend alerts
  • Client template (clients/_client-template/):

    • CLAUDE.md — Engagement context (who they are, your role, key people, current status, tone)
    • playbook.md — Client-specific operating rules (always-material topics, safe auto-send patterns, pricing guardrails, standard documents)
    • contacts.yaml — Routing detail and contact metadata (names, roles, sides, always_review flags)
    • Folder structure: inbox/, pending-approval/, outbox/, decisions/, meetings/, feedback/, examples/
  • README.md — Build runbook for Phase 0–4:

    • Phase 0: skeleton + pilot migration (confirm cowork file source, create service account, verify

https://claude.ai/code/session_011AfTrSBHggjMUePW9LWaoi

claude added 3 commits May 13, 2026 03:59
Client folder template (CLAUDE.md, playbook.md, contacts.yaml + working
subdirs), the cross-client global-playbook, a routing/risk config schema,
on-disk file-format spec, and a phased build runbook. Code for the Managed
Agent, ingress Worker, whatsmeow bridge, and Plaud connector lands in later
phases; real config and client data stay out of the repo per .gitignore.

https://claude.ai/code/session_011AfTrSBHggjMUePW9LWaoi
The orchestrator "brain": agent.yaml (model, MCP servers, input schema, success
rubric, completion webhook) + system-prompt.md covering process/approve/reject/
reflect modes, plus a README with instantiation steps and verification payloads.
v1 is a single agent doing classify -> act inline; sub-agent fan-out is deferred.

https://claude.ai/code/session_011AfTrSBHggjMUePW9LWaoi
Single-source the risk-classification rule in global-playbook.md (system
prompt now defers to it instead of duplicating). Add an explicit completion
JSON contract to the agent (input_schema + completion_schema in agent.yaml,
matching "Completion contract" in system-prompt.md) so the ingress can parse
results structurally rather than scraping a string.

Make I/O ordering and parallelism explicit in the system prompt: tiered Drive
reads (route -> context -> draft), parallel reads/writes, routing_hint
short-circuits other clients' reads, agent bails fast (action: deduped) on a
repeat item_id. Add io_targets to agent.yaml as guardrails.

Add a deterministic id derivation rule to FORMATS.md (sha256 of channel +
provider_message_id, first 12 hex) so retries are idempotent across ingress
and agent. Drop the redundant <source> segment from inbox filenames. Add a
kind discriminator (draft_reply | meeting_followup | config_proposal) to
pending-approval, with config_proposal carrying target_file + patch so the
approve handler knows what to do without sniffing the body. Add
provider_message_id_out + sent_via to outbox/ for loop-prevention. Align the
feedback enum and add correction_kind matching the reflection run's pattern
categories. Specify the v1 examples retrieval method (tag overlap + lexical).

Tighten the reflect mode: define "pattern" precisely (same correction_kind
on same field/topic, >=2 in 30 days), cap proposals per run, gate
global-playbook proposals on cross-client recurrence. Fold triage into
projects: so default_project: triage resolves cleanly. Update the agent
README verification payloads to match the new schema (item_id pattern,
routing_hint, snippet/body_uri, idempotency check, efficiency check).

https://claude.ai/code/session_011AfTrSBHggjMUePW9LWaoi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants