Add orchestrator Phase 0: file formats, system prompt, and agent definition#1
Open
davemeng wants to merge 3 commits into
Open
Add orchestrator Phase 0: file formats, system prompt, and agent definition#1davemeng wants to merge 3 commits into
davemeng wants to merge 3 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 eachClients/<X>/folder:idderivation (dedupe key based on SHA256 of channel + provider message ID)inbox/<ts>-<id>.md— incoming items with full classification metadatapending-approval/<id>.md— drafts awaiting sign-off (replies, meeting followups, config proposals)outbox/<id>.md— audit copies of sent messages with loop-prevention keysdecisions/<date>-<slug>.md— append-only ledger of actions taken and reasoningmeetings/<date>-<slug>.md— Plaud transcripts with extracted decisions and action itemsfeedback/<id>.json— labeled corrections for the learning loopexamples/<slug>.md— curated (situation → ideal reply) pairs for in-context retrievalsystem-prompt.md— Complete system prompt for the Managed Agent covering:process(new inbound),approve(sign-off),reject(decline),reflect(weekly learning)global-playbook.mdto avoid duplication)routing.yamlor classifier fallback)agent.yaml— Portable Managed Agent definition:global-playbook.md— Cross-client rules (single source of truth):routing.example.yaml— Routing + risk config schema with examples: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)inbox/,pending-approval/,outbox/,decisions/,meetings/,feedback/,examples/README.md— Build runbook for Phase 0–4:https://claude.ai/code/session_011AfTrSBHggjMUePW9LWaoi