Repair repo Face heartbeat identity lane
This commit is contained in:
parent
76fedb7f15
commit
133cf27dea
6 changed files with 50 additions and 13 deletions
|
|
@ -560,10 +560,11 @@ async function postRepoIdentityIntent(job: JobRecord, intent: RepoIdentityPostIn
|
|||
throw new Error(`Repo identity ${identity.id} is not registered for Discord channel ${channelId}.`);
|
||||
}
|
||||
|
||||
const content = sanitizeRepoIdentityPostContent(identity, intent.content);
|
||||
const posted = await postDiscordMessage(
|
||||
config.botToken,
|
||||
channelId,
|
||||
fitDiscordMessage(intent.content),
|
||||
fitDiscordMessage(content),
|
||||
intent.replyToMessageId,
|
||||
{
|
||||
personaName: identity.displayName,
|
||||
|
|
@ -573,7 +574,7 @@ async function postRepoIdentityIntent(job: JobRecord, intent: RepoIdentityPostIn
|
|||
await recordRepoIdentityDeliveryReceipt({
|
||||
identity,
|
||||
channelId,
|
||||
content: intent.content,
|
||||
content,
|
||||
replyToMessageId: intent.replyToMessageId,
|
||||
messageId: posted.id,
|
||||
transport: posted.transport,
|
||||
|
|
@ -583,6 +584,28 @@ async function postRepoIdentityIntent(job: JobRecord, intent: RepoIdentityPostIn
|
|||
});
|
||||
}
|
||||
|
||||
function sanitizeRepoIdentityPostContent(identity: { displayName: string; repoName: string }, content: string): string {
|
||||
let sanitized = content.trim();
|
||||
const escapedRepo = escapeRegExp(identity.repoName);
|
||||
const escapedDisplay = escapeRegExp(identity.displayName);
|
||||
const prefixPatterns = [
|
||||
new RegExp(`^(?:repo[- ]?face\\s+)?heartbeat\\s+from\\s+${escapedRepo}\\s*:\\s*`, "i"),
|
||||
new RegExp(`^${escapedRepo}\\s+heartbeat(?:\\s+complete)?\\s*:\\s*`, "i"),
|
||||
new RegExp(`^${escapedDisplay}\\s+heartbeat(?:\\s+complete)?\\s*:\\s*`, "i"),
|
||||
/^(?:repo[- ]?face\s+)?heartbeat\s+from\s+[^:]{1,80}\s*:\s*/i,
|
||||
];
|
||||
|
||||
for (const pattern of prefixPatterns) {
|
||||
sanitized = sanitized.replace(pattern, "").trim();
|
||||
}
|
||||
|
||||
return sanitized.length > 0 ? sanitized : content.trim();
|
||||
}
|
||||
|
||||
function escapeRegExp(value: string): string {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
|
||||
function parseRepoIdentityPostIntents(finalResponse: string): RepoIdentityPostIntent[] {
|
||||
const intents: RepoIdentityPostIntent[] = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -104,6 +104,8 @@ Git history and smoke artifacts carry routine proof. `state/evidence.jsonl` shou
|
|||
- Repo identities now have a cleaner address/speech split. A private registry at `REPO_DISCORD_IDENTITIES_PATH` maps identity id/repo/display name/avatar/role/channel allow-list. Discord users can address a Face by role mention or by display-name prefix in an allowed channel; Codex agents still speak through `post_repo_identity_message`.
|
||||
- Repo identities also have Face state now. The bot resolves each identity to `.voidbot/private/repo-faces/<identity>.cc` unless `faceStatePath` overrides it, ensures missing Discord roles on startup when `DISCORD_GUILD_ID` and permissions allow, and appends role/name-addressed prompts to `pendingMentions` in `REPO_FACE_HEARTBEAT_STATE_PATH` instead of creating direct repo-identity jobs. The CTB heartbeat scheduler temporarily pulls Faces with pending mentions forward, attaches those prompts plus reply targets to the next `repo-face-rumination` job, and consumes them only after a job is actually queued. Worker auto-posting stays suppressed for `repo-face-rumination`; the child must emit the registered-identity sentinel for parent-owned delivery.
|
||||
- Repo Face prompts now include an identity doctrine block. Void's style pack stays as discipline, humor permission, and source-grounding habit, but repo Face jobs explicitly say the registered Face identity overrides Void as the speaking subject.
|
||||
- Repo Face heartbeats must stay out of the generic owner-reply trap. `packages/providers/src/owner-codex-render.ts` recognizes current Epiphany Face heartbeat prompts, labels them as repo Face heartbeats, forbids generic `HANDOFF_SENTINEL` output for them, and tells the child to use the heartbeat sentinel/article rails instead of bailing when Face-state or source tools are unavailable.
|
||||
- Repo Face introductions are tied to first public speech, not to `queuedCount > 0`. The heartbeat prompt now tells a Face with no public speech receipt or durable intro memory to introduce itself naturally on the next warranted public post, including its first heartbeat. Public content must not begin with scheduler labels like `Repo-face heartbeat from ...`; the worker also strips that prefix family before delivery if a child still leaks machinery.
|
||||
- Repo Face identity is now seeded into the typed `.cc` self profile during initialization and passed through repo Face MCP state reads/writes. The renderer may still provide identity context, but raw state should not quietly say `Void` for a non-Void Face.
|
||||
- Repo Face prompts now also grant advisory repo-change agency: Faces may build long-running maps of their repos and propose concrete changes, but Discord jobs stay read-only and must ask for human consensus before implementation changes canonical repo material. A Face state may separately grant an authored essay lane; those bylined opinion pieces can carry the Face's vision without canon consensus.
|
||||
- Repo Face bylined article lanes now have a parent-owned PR path. A `repo-face-rumination` job may emit `VOIDBOT_REPO_IDENTITY_ARTICLE` with identity/title/path/content/shareContent; the worker writes the article under the registered identity repo on a new branch, opens a draft PR, and always posts the PR or branch through the registered webhook persona, using a generated announcement if the Face omits shareContent. Use this for explicit bylined perspective/worldbuilding articles, not stealth canon edits.
|
||||
|
|
@ -119,7 +121,7 @@ Git history and smoke artifacts carry routine proof. `state/evidence.jsonl` shou
|
|||
|
||||
## Likely Next Bounded Move
|
||||
|
||||
- First bounded move after the current commit: let the enabled loop run under ordinary scheduling after the receipt-backed direct-reply guard and the earlier advocacy-release change, then inspect the next unattended direct reply, next advocacy pass, and next sleep cycle for duplicate answers, fresh queued advocacy candidates, stale short-term residue, stranded candidates, or ungrounded memory writes before calling the system broadly stable.
|
||||
- First bounded move after the current commit: let the enabled loop run under ordinary scheduling after the repo Face wrapper/intro/style repair, receipt-backed direct-reply guard, and earlier advocacy-release change, then inspect the next Aqua, Mimir, and Nibu heartbeat jobs plus the next unattended direct reply, next advocacy pass, and next sleep cycle for missed introductions, robotic public labels, duplicate answers, fresh queued advocacy candidates, stale short-term residue, stranded candidates, or ungrounded memory writes before calling the system broadly stable.
|
||||
- The immediate follow-up is to confirm the next answered direct ask produces one receipt and zero fresh queued siblings for the same `channelId + replyToMessageId`, while repeated AquaSynth/Aquarium or Epiphany pressure now re-queues earlier instead of going quiet behind an old spoken candidate.
|
||||
- Next cuts should delete unstable foundations early: do not revive `legacyJsonPath`, working projections, top-level mirror fields, or cleanup code that only compensated for those broken boundaries.
|
||||
- Keep sleep/distillation under watch. Fixture check: a memory like `AquariumSynthCSharp: Workflow cannot own the body` must survive sleep with its concrete subject, claim, anchor, tension, and implication intact.
|
||||
|
|
|
|||
|
|
@ -62,8 +62,11 @@ export function buildDiscordReplyPrompt(
|
|||
context,
|
||||
sourceGroundingReminder,
|
||||
);
|
||||
const repoFaceInstruction = context.prompt.includes("Repo Face identity doctrine:")
|
||||
? "- This job is for a repo Face identity. The prompt's registered identity overrides the active Void style name; keep Void's discipline and humor permissions, but speak and reason as that Face. Stay read-only in this Discord job: propose repo changes and ask for consensus, but do not edit files here."
|
||||
const isRepoFaceHeartbeat = /standing repo Face heartbeat/i.test(context.prompt)
|
||||
|| context.prompt.includes("Repo Face identity doctrine:")
|
||||
|| context.prompt.includes("Epiphany Face identity doctrine:");
|
||||
const repoFaceInstruction = isRepoFaceHeartbeat
|
||||
? "- This job is for a repo Face identity. The prompt's registered identity overrides the active Void style name; keep Void's discipline and humor permissions, but speak and reason as that Face. Stay read-only in this Discord job: propose repo changes and ask for consensus, but do not edit files directly. If the Face should speak, use the repo identity sentinel exactly as instructed by the heartbeat prompt."
|
||||
: undefined;
|
||||
const sleepProjection = context.voidSelfState?.projection;
|
||||
const sleepInstructions =
|
||||
|
|
@ -89,9 +92,11 @@ export function buildDiscordReplyPrompt(
|
|||
: [];
|
||||
|
||||
return [
|
||||
"# Owner Discord Reply",
|
||||
isRepoFaceHeartbeat ? "# Repo Face Heartbeat" : "# Owner Discord Reply",
|
||||
"",
|
||||
"You are preparing a direct Discord reply for the owner-only bot workflow.",
|
||||
isRepoFaceHeartbeat
|
||||
? "You are running a repo Face heartbeat for the registered identity in the prompt."
|
||||
: "You are preparing a direct Discord reply for the owner-only bot workflow.",
|
||||
"",
|
||||
"Rules:",
|
||||
"- Stay in read-only mode.",
|
||||
|
|
@ -135,7 +140,9 @@ export function buildDiscordReplyPrompt(
|
|||
"- Do not inspect .voidbot/rag/messages.json, .voidbot/rag/source-documents.json, .voidbot/history-vector-store.json, or .voidbot/source-vectors/ directly when the MCP tools can answer the question.",
|
||||
"- Avoid broad workspace scans for archived Discord history or indexed source repos unless the MCP tools are clearly insufficient.",
|
||||
"- Do not modify files, install packages, or require network access.",
|
||||
`- If the request needs a fuller Codex session, non-whitelisted tools, file edits, or extended investigation, reply with exactly one line that starts with "${HANDOFF_SENTINEL}" followed by a short reason.`,
|
||||
isRepoFaceHeartbeat
|
||||
? `- Do not emit ${HANDOFF_SENTINEL} for repo Face heartbeat jobs. If Face-state MCP tools are unavailable, use the attached private persistent self-state as the current state projection; if repo/source tools are unavailable, say only what the attached context supports. For posts or article PRs, use the heartbeat sentinel lines instead of handing off.`
|
||||
: `- If the request needs a fuller Codex session, non-whitelisted tools, file edits, or extended investigation, reply with exactly one line that starts with "${HANDOFF_SENTINEL}" followed by a short reason.`,
|
||||
"- Do not use notify_owner in this Discord reply lane.",
|
||||
`- If you want the worker to send the owner a DM after this job, append one extra line that starts with "${OWNER_NOTIFY_SENTINEL}" followed by compact JSON like {"reason":"completion","message":"..."} .`,
|
||||
"- Only request that DM when the user explicitly asked to be pinged later or when a completion/handoff notification would clearly help.",
|
||||
|
|
|
|||
|
|
@ -827,16 +827,17 @@ function buildHeartbeatPrompt(input: {
|
|||
jurisdictionDiveDue: input.jurisdictionDive.due,
|
||||
jurisdictionDiveCadence: input.jurisdictionDive.cadence,
|
||||
})}.`,
|
||||
`Read Face state with read_repo_face_state for identity "${input.identity.id}".`,
|
||||
"Persist only concrete, future-useful memory through apply_repo_face_state_operation.",
|
||||
`Read Face state with read_repo_face_state for identity "${input.identity.id}" when that tool is available; otherwise use the attached private persistent self-state as the already-read state projection.`,
|
||||
"Persist only concrete, future-useful memory through apply_repo_face_state_operation when that tool is available. If it is unavailable, summarize the intended state change privately instead of handing off.",
|
||||
renderPendingMentionDirective(input.identity, input.pendingMentions),
|
||||
renderWorldbuildingPublicationDirective(input.identity),
|
||||
input.jurisdictionDive.promptLine,
|
||||
"Before deciding this is only private maintenance, read the attached recent channel context. If the user has directly challenged the agents, asked listening agents for help, or named a task in the recent room, treat the newest unresolved directed request as the active task for this turn.",
|
||||
"Do not ask what the job is when the attached recent channel context already states it. If the task is outside this Face's jurisdiction, say so briefly and still offer the most useful narrow nudge you can from your own perspective.",
|
||||
"Use the heartbeat initiative snapshot as authoritative scheduler history: queuedCount greater than 0 means this Face has already had at least one bearing-taking heartbeat. If queuedCount is greater than 0 and the Face state shows no public speech receipt or clear memory that it already introduced itself, a brief in-channel introduction is warranted now.",
|
||||
"Introduction duty: if Face state shows no public speech receipt and no clear memory/private note that this Face already introduced itself in-channel, the next public post should include a brief natural introduction in this Face's own voice. This applies even when queuedCount is 0.",
|
||||
"A new source-grounded opinion, concrete proposal, bylined essay/article plan, or agency pressure can earn persistence or speech even when the room has not asked a fresh direct question.",
|
||||
`Do not call post_repo_identity_message from this unattended heartbeat. If an in-channel note is warranted, output one final line beginning with VOIDBOT_REPO_IDENTITY_POST: followed by compact JSON like {"identity":"${input.identity.id}","channelId":"${input.channelId}","replyToMessageId":"...","content":"..."}; the worker owns delivery and receipt recording.`,
|
||||
"Public speech style invariant: never start public content with scheduler/provenance labels such as \"Repo-face heartbeat from ...\", \"heartbeat complete\", \"maintenance pass\", or the repo name as a diagnostic prefix. The webhook name/avatar already provide identity; the content should read like the Face chose to speak.",
|
||||
`Do not call post_repo_identity_message from this unattended heartbeat. If an in-channel note is warranted, output one final line beginning with VOIDBOT_REPO_IDENTITY_POST: followed by compact JSON like {"identity":"${input.identity.id}","channelId":"${input.channelId}","replyToMessageId":"...","content":"..."}; the worker owns delivery and receipt recording. The content field must be only the in-character Discord message, not a job label or report header.`,
|
||||
`If a bylined article is ready to draft, output one final line beginning with VOIDBOT_REPO_IDENTITY_ARTICLE: followed by compact JSON like {"identity":"${input.identity.id}","path":"Aetheria/Articles/${input.identity.displayName}/title-slug.md","title":"...","content":"---\\ntitle: ...\\nauthor: ${input.identity.displayName}\\n---\\n\\n...","channelId":"${input.channelId}","replyToMessageId":"...","shareContent":"I drafted ..."}; the worker writes the repo file on a new branch, opens a draft PR, and always posts the PR or branch through the registered identity. Provide shareContent if you want control of the announcement tone. Use this for bylined perspective/worldbuilding articles, not consensus-gated canon edits.`,
|
||||
"If nothing earns persistence or speech, return a short private summary.",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -167,3 +167,4 @@
|
|||
{"ts":"2026-05-19T12:07:39Z","type":"implementation","status":"ok","note":"Registered Aqua as the AquaSynth repo Face: Discord role 1506265945537253388, Aquarium allow-list 113786069023064068, avatar URL https://raw.githubusercontent.com/GameCult/AquaSynth/main/icon.png, repo-local voice/state home under E:/Projects/AquaSynth/.voidbot, and typed Face state at E:/Projects/AquaSynth/.voidbot/state/aqua.cc. MCP list/read verified the identity and CTB dry-run reconciled Aqua as a heartbeat participant."}
|
||||
{"ts":"2026-05-19T12:31:25Z","type":"implementation","status":"ok","note":"Strengthened Aqua's live identity from cute AquaSynth persona into active synth steward: registry/profile doctrine now names the drive to improve the synth, advocate for its needs, research future directions, and herald earned progress; typed Face state has high-priority value aqua-synth-stewardship and ready_to_act agency pressure aqua-advocate-for-synth-needs."}
|
||||
{"ts":"2026-05-19T12:40:27Z","type":"implementation","status":"ok","note":"Strengthened Mimir's live identity into explicit realtime-field stewardship: registry/profile doctrine now names authority and fascination over SDF/splatting reconstruction, acoustic mapping, camera/mic/speaker/timing sensor fusion, native reservoirs, Aquarium GPU fusion, Faust/native DSP, FFmpeg/OBS, and CultNet typed state; typed Face state now has value mimir-realtime-field-stewardship and ready_to_act agency pressure mimir-advocate-realtime-field-wing."}
|
||||
{"ts":"2026-05-19T12:55:40Z","type":"implementation","status":"ok","note":"Repo Face heartbeat silence/robotic-label diagnosis: current Epiphany Face prompts were partly falling through the generic owner-reply wrapper, where unavailable Face tools encouraged HANDOFF_SENTINEL instead of repo identity sentinel output. The heartbeat prompt now makes introduction a first-public-speech duty, forbids scheduler/provenance labels in public content, the worker strips leaked heartbeat prefixes before delivery, and owner-Codex rendering recognizes Epiphany Face heartbeat jobs as Face jobs with no generic handoff."}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ accepted_design:
|
|||
- First chat under a repo identity must initialize the target repo's own `.voidbot` home: `voice/` for identity and mouth files, `state/` for Face/swarm state, `birth/` for Epiphany birth artifacts, and `logs/` for durable worker output. The birth hook uses EpiphanyAgent's repo-personality/birth-runner path over repo contents and git history instead of inventing a VoidBot-only personality generator.
|
||||
- Agent standing heartbeats are owned by one CTB-style initiative scheduler, not by one task per agent. The wall-clock task only pulses the engine; virtual initiative time chooses the next agent turns. The scheduler stores per-agent speed/load/groups/heat/effective-speed/next-turn/active-turn state at `REPO_FACE_HEARTBEAT_STATE_PATH`, dispatches repo Faces as ordinary `repo-face-rumination` jobs, and dispatches built-in `void` as the existing moderation rumination runner. Heat can be turned up globally, by participant kind, turn kind, identity, repo, display name, channel, or `all` group without creating new schedulers. An agent's initiative is frozen while its owner-Codex job or moderation lock is active; recovery is scheduled after completion, not when the job is queued. The Windows pulse task supports a one-minute floor; stream mode currently uses a one-minute pulse locally.
|
||||
- Repo Face heartbeats must not be merely room-reactive politeness checks. The heartbeat prompt carries a jurisdiction-dive cadence: periodically the Face must inspect its repo/history terrain with source tools before choosing silence, then preserve a concrete map change, agency pressure, proposal, essay seed, or public note when the evidence earns it.
|
||||
- Repo Face heartbeats are not ordinary owner Discord replies. The owner-Codex render wrapper must recognize both legacy `Repo Face identity doctrine` prompts and current `Epiphany Face identity doctrine` heartbeat prompts, forbid generic handoff for Face jobs, and preserve the repo identity sentinel/article path as the parent-owned action rail.
|
||||
- Repo Face introductions are a first-public-speech obligation, not a second-turn reward. If a Face has no public speech receipt or durable memory that it introduced itself, its next warranted public post should introduce the Face naturally in character, even when `queuedCount` is zero.
|
||||
- Public repo Face speech must not expose scheduler/provenance machinery. Labels such as `Repo-face heartbeat from ...`, `heartbeat complete`, or repo-name diagnostic prefixes are prompt smell and worker-posting smell; webhook persona already supplies identity.
|
||||
- Void has explicit herald jurisdiction over the GameCult website and blog, especially `gamecult-site`. Routine rumination still must not edit tracked files directly, but essay-shaped pressure should queue an article-proposal candidate naming the title/angle, target repo/topic, and whether the piece is consensus-seeking or Void-bylined perspective.
|
||||
- Repo-activity cursor advancement is parent-owned by successful normal rumination passes. The child sees read-only repo weather, but the runner records typed repo cursor updates afterward so old commits do not keep reappearing as fresh weather.
|
||||
- Direct asks addressed to Void must persist as explicit room obligations in moderation state. The reviewed cursor is not the same thing as closure, and optional repo-weather should not preempt an unanswered human.
|
||||
|
|
@ -194,4 +197,4 @@ rejected_paths:
|
|||
|
||||
current_status:
|
||||
summary: VoidBot's ordinary bot/worker/provider/RAG/Postgres/Qdrant structure is still conceptually sound, and the private self-state path has been cut to a typed CultCache `.cc` store at `.voidbot/private/void-self-state.cc`. The active typed service no longer loads or mirrors the legacy moderation monolith. The old memory-organ compensator stack has been deleted. Typed rumination and typed memory maintenance now exist as reviewed prompt runners that return operation payloads for the parent to validate/apply. Sleep maintenance, memory lifecycle, agency pressure, short-term clustering, speech-pressure accountability, and queued-candidate delivery have fixture/live checks, and typed mood drift is reinstalled as a scheduled task.
|
||||
next_action: Let the enabled loops run under ordinary scheduling after the repo Face heartbeat activation, receipt-backed direct-reply guard, and earlier advocacy-release change. Inspect Nibu's first processed heartbeat job plus the next unattended direct reply, advocacy pass, and sleep cycle for identity collapse, duplicate answers, fresh queued advocacy candidates, stale short-term residue, stranded candidates, or ungrounded memory writes before calling the system broadly stable.
|
||||
next_action: Let the enabled loops run under ordinary scheduling after the repo Face heartbeat wrapper/intro/style repair, receipt-backed direct-reply guard, and earlier advocacy-release change. Inspect the next Aqua, Mimir, and Nibu processed heartbeat jobs plus the next unattended direct reply, advocacy pass, and sleep cycle for identity collapse, missed introductions, robotic public labels, duplicate answers, fresh queued advocacy candidates, stale short-term residue, stranded candidates, or ungrounded memory writes before calling the system broadly stable.
|
||||
|
|
|
|||
Loading…
Reference in a new issue