{"modulePath":"github.com/memcode-ai/memcode","version":"v0.56.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package events\n\nPackage events defines the canonical event kinds and a typed helper for appending them. The event log (in internal/store) is the source of truth for the whole state engine; everything else is a projection rebuilt from it.\n\n## Functions\n\n```go\nfunc Append(ctx context.Context, s store.Store, kind Kind, actor string, payload any) (int64, error)\n```\nAppend records an event with a JSON-encodable payload and returns its id. actor is who/what produced it (e.g. \"user\", \"agent\", \"reducer\", a git author).\n\n## Types\n\n```go\ntype Kind string\n```\nKind enumerates the canonical event kinds.\n\n```go\nconst (\n\t// Repository signals.\n\tKindCommit  Kind = \"commit\"\n\tKindDiff    Kind = \"diff\"\n\tKindFileAdd Kind = \"file_add\"\n\tKindFileDel Kind = \"file_del\"\n\tKindTestRun Kind = \"test_run\"\n\n\t// Agent signals.\n\tKindAgentAction          Kind = \"agent_action\"\n\tKindAgentSessionStarted  Kind = \"agent_session_started\"\n\tKindAgentSessionFinished Kind = \"agent_session_finished\"\n\tKindToolCalled           Kind = \"tool_called\"\n\tKindCommandExecuted      Kind = \"command_executed\"\n\tKindFileEdited           Kind = \"file_edited\"\n\tKindActionDenied         Kind = \"action_denied\"     // user declined an edit/command (trust signal)\n\tKindSessionOutcome       Kind = \"session_outcome\"   // accepted | corrected | rejected (acceptance telemetry)\n\tKindTodosUpdated         Kind = \"todos_updated\"     // agent's work-tracker checklist snapshot\n\tKindContextCompacted     Kind = \"context_compacted\" // older turns summarized to fit the window/cheap lane\n\n\t// Plan mode (deliberate research → proposal → approval loop).\n\tKindPlanStarted   Kind = \"plan_started\"\n\tKindPlanReflected Kind = \"plan_reflected\" // executive reflection: sufficient? research/ask/synthesize\n\tKindPlanReviewed  Kind = \"plan_reviewed\"  // cross-model critic verdict: ok | revise | escalate\n\tKindPlanProposed  Kind = \"plan_proposed\"  // a plan was drafted (revision 0)\n\tKindPlanRevised   Kind = \"plan_revised\"   // a plan was revised on feedback\n\tKindPlanApproved  Kind = \"plan_approved\"  // user approved → hand off to execution\n\tKindPlanCancelled Kind = \"plan_cancelled\" // user discarded the plan\n\n\t// Interactive input + multimodal.\n\tKindUserInputReceived  Kind = \"user_input_received\"\n\tKindInputSteered       Kind = \"input_steered\"\n\tKindInputQueued        Kind = \"input_queued\"\n\tKindInputInterrupted   Kind = \"input_interrupted\"\n\tKindAttachmentDetected Kind = \"attachment_detected\"\n\tKindAttachmentSent     Kind = \"attachment_sent_to_model\"\n\tKindAttachmentRejected Kind = \"attachment_rejected\"\n\n\t// Continuity signals — the human's voice. These consolidate into doctrine\n\t// and decisions so a project's intent survives across sessions.\n\tKindUserNote         Kind = \"user_note\"\n\tKindAssertion        Kind = \"assertion\"\n\tKindDecision         Kind = \"decision\"\n\tKindFrustration      Kind = \"frustration\"\n\tKindPreferenceSignal Kind = \"preference_signal\" // user stated a durable taste/constraint to remember (LLM-captured, reducer-promoted)\n\tKindLessonSignal     Kind = \"lesson_signal\"     // a strategy lesson distilled from a learning episode (failure-repair / human-correction / rejection; reducer-promoted like preferences)\n\n\t// The post-session learning loop (see runtime.processOutcomes): which promoted\n\t// rules rode a session's context, whether the agent followed them, and a marker\n\t// so each session_outcome is distilled/judged exactly once.\n\tKindContextInlined   Kind = \"context_inlined\"   // {session_id, lesson_ids, pref_ids} — the rules the model actually saw\n\tKindAdherence        Kind = \"adherence\"         // {session_id, rule_kind, rule_id, verdict, outcome} — judge verdict, feeds reducer weights\n\tKindOutcomeProcessed Kind = \"outcome_processed\" // {session_id} — this outcome's learning pass ran (attempted counts; failures are dropped, not retried)\n\n\t// Reducer-emitted.\n\tKindNote      Kind = \"note\"\n\tKindDeviation Kind = \"deviation\"\n\n\t// Per-turn efficiency telemetry: how much read-only GATHERING a turn did, the\n\t// mode budget it ran under, whether the gather→act gate fired, and which targets\n\t// were re-read. The deterministic substrate for retrospective cost/efficiency\n\t// analysis (/analyze) — so an expensive turn is diagnosable from data, not vibes.\n\tKindGatherSummary Kind = \"gather_summary\"\n\n\t// Gateway — the self-hosted channel gateway (Telegram/Discord/Slack/GitHub/\n\t// WhatsApp → agent). These make gateway activity visible in the main event log\n\t// without pretending an inbound chat message is a project objective. Payloads\n\t// carry {channel, conversation, principal_id, message_id, job_id, status} as\n\t// relevant.\n\tKindGatewayMessageReceived Kind = \"gateway_message_received\"\n\tKindGatewayJobSpawned      Kind = \"gateway_job_spawned\"\n\tKindGatewayResultPosted    Kind = \"gateway_result_posted\"\n\tKindGatewayMessageDropped  Kind = \"gateway_message_dropped\" // not a trigger (e.g. no mention in a group)\n\tKindGatewayUnauthorized    Kind = \"gateway_unauthorized\"    // sender not allow-listed\n\tKindGatewayPairingOffered  Kind = \"gateway_pairing_offered\" // unknown DM sender handed a pairing code\n)\n```\n\n","path":"github.com/memcode-ai/memcode/internal/events","name":"events","synopsis":"Package events defines the canonical event kinds and a typed helper for appending them.","isRedistributable":true}
