Documentation
¶
Overview ¶
agent_bus_inlet.go — Dashboard chat inlet for the metabolic cycle.
Wires the Mod³ dashboard to the cogos kernel's external-event channel:
Mod³ → POST /v1/bus/send bus_id=bus_dashboard_chat
→ appendBusEvent dispatches to in-process handlers
→ this file's handler → engine.Process.SubmitExternal
The inverse direction (kernel → Mod³) is handled by the `respond` tool (agent_tools_respond.go), which publishes to bus_dashboard_response; Mod³ subscribes via the existing /v1/events/stream SSE endpoint.
Wiring: call InstallDashboardInlet(busMgr, process) once at daemon start alongside InstallTraceEmitter. The process argument may be nil (main daemon does not currently own a *engine.Process); in that case the handler still ensures the bus exists and logs incoming messages so the wiring is observable even before the v3 process is instantiated in this binary.
agent_harness.go — Native Go agent harness for the homeostatic kernel loop.
Runs as a goroutine inside the kernel process. Calls a local model (Gemma E4B via Ollama) through the OpenAI chat completions wire protocol. The loop is:
Observation → Assess (JSON mode) → Execute (tool loop) → Callback
No framework dependencies. Uses net/http directly against Ollama's OpenAI-compatible /v1/chat/completions endpoint.
agent_tools.go — Kernel-native tool implementations for the agent harness.
Each tool is a Go function with the ToolFunc signature that wraps existing kernel functionality. Tools are registered with the AgentHarness and dispatched when the model invokes them via tool_calls.
kernel_harness.go is the integration layer between the CogOS kernel (package main) and the inference harness (package harness).
It provides three things:
kernelServicesAdapter — implements harness.KernelServices by wrapping existing kernel functions (dispatch, emitEvent, depositSignal, etc.)
Type conversion functions — the kernel and harness have parallel type hierarchies (both define InferenceRequest, ContextState, etc.). These converters bridge them at the boundary.
Shim functions (HarnessRunInference, HarnessRunInferenceStream) — called by serve.go and inference.go where the old RunInference/RunInferenceStream used to be called. They convert kernel→harness, delegate, then convert back.
Call flow:
serve.go:handleChatCompletions
→ HarnessRunInference(kernelReq) ← this file
→ toHarnessRequest(kernelReq) ← type conversion
→ harness.Harness.RunInference(hReq) ← harness package
→ fromHarnessResponse(hResp) ← type conversion
← kernelResp
modality_hud.go — Formats modality bus state for agent context injection (zone 5).
modality_router.go — EventRouter connects the ModalityBus to the kernel's event systems: ledger (persistence), listeners (streaming), salience.
trace_emit.go — Bus-publish helper for cycle-trace events (ADR-083).
This file is the bridge between the schema-only `trace` subpackage and the kernel's bus API (`busSessionManager.appendBusEvent`). Emission is best-effort and non-blocking: errors are logged, never propagated. Losing a trace event is always preferable to stalling the metabolic cycle.
Wiring:
- At serve startup, call `InstallTraceEmitter(busManager, root)` once. That sets:
- trace bus ensured on disk (`bus_cycle_trace`)
- `engine.TraceEmitter` hook wired to `emitCycleEvent`
- `engine.TraceIdentity` wired to the active identity name After that, engine/process.go and the agent harness can call `emitCycleEvent` (or the engine hook) without further setup.
ADR-084 dataref migration policy (Phase 1: schema-additive) — this file is the G3 pilot consumer of the by-reference emit path. Two paths coexist inside emitCycleEvent:
- Inline (legacy / default): JSON-decoded payload map is stamped onto CogBlock.Payload via appendBusEvent.
- By-reference (Phase 2 pilot): when COGOS_DATAREF_EMIT contains the "cycle_trace" token AND a BlobStore is wired, the raw bytes are stored content-addressed and the envelope carries only Digest + MediaType + Size via appendBusEventRef; Payload is nil. BlobStore errors fall through to the inline path so events are never dropped.
Consumers of bus_cycle_trace MUST tolerate both shapes during Phase 1 and resolve byref-first (Digest -> GET /v1/blobs/:digest, else inline Payload). The media type is the single `traceMediaType` constant below, so decoders can switch on it regardless of envelope shape.
See: .cog/adr/084-bus-payloads-as-cogblocks.cog.md
Source Files
¶
- agent_bus_inlet.go
- agent_crd.go
- agent_dispatch.go
- agent_harness.go
- agent_provider.go
- agent_tools.go
- agent_tools_propose.go
- agent_tools_respond.go
- agent_tools_wait.go
- bep_engine.go
- bep_events.go
- bep_index.go
- bep_model.go
- bep_proto.go
- bep_provider.go
- bep_receiver.go
- bep_tls.go
- bep_wire.go
- block_index.go
- bus_capabilities.go
- bus_config.go
- bus_event_format.go
- bus_router.go
- bus_session.go
- bus_tool.go
- bus_tool_router.go
- bus_watch.go
- bus_watch_filter.go
- capability_advertiser.go
- capability_cache.go
- capability_resolver.go
- channel_config.go
- channel_types.go
- cmd_bus.go
- cmd_constellation.go
- cmd_events_jsonl.go
- cmd_node.go
- cmd_skill.go
- cmd_timeline.go
- cog.go
- complete.go
- component_wiring.go
- components.go
- config_taa.go
- constellation_bus.go
- constellation_sessions.go
- constellation_singleton.go
- context_compressor.go
- context_constructor.go
- context_engine.go
- context_engine_types.go
- decompose.go
- decompose_store.go
- decompose_tui.go
- discord_hcl.go
- discord_provider.go
- discord_reconcile.go
- docker_client.go
- eval_wiring.go
- extract.go
- fleet.go
- frontmatter.go
- gateway_client.go
- handlers.go
- hook_session_context.go
- hook_working_memory.go
- identity_crd.go
- identity_provider.go
- inference.go
- kernel_harness.go
- ledger_core.go
- lifecycle.go
- local_runner.go
- memory.go
- memory_scope.go
- merge.go
- modality_bus.go
- modality_events.go
- modality_http.go
- modality_hud.go
- modality_ledger.go
- modality_router.go
- modality_salience.go
- modality_supervisor.go
- modality_text.go
- modality_types.go
- modality_voice.go
- modality_wire.go
- narrative.go
- node_config.go
- oci.go
- openclaw_agent_projector.go
- openclaw_bridge.go
- openclaw_cron_projector.go
- openclaw_gateway_provider.go
- otel.go
- policy.go
- probe_scorer.go
- projection.go
- rbac.go
- reactor.go
- reactor_subscriptions.go
- reconcile_events.go
- reconcile_helpers.go
- reconcile_mcp_tools.go
- reconcile_meta.go
- reconcile_registry.go
- reconcile_state.go
- reconcile_types.go
- registry_indexer.go
- replay.go
- research.go
- research_unix.go
- salience.go
- sections.go
- serve_types.go
- service_crd.go
- service_provider.go
- session.go
- session_manager.go
- shadow_log.go
- task_orchestration.go
- thread_parser.go
- tier1_identity.go
- tier2_temporal.go
- tier3_present.go
- tier4_semantic.go
- timeline.go
- tool_bridge.go
- tools_bridge.go
- trace_emit.go
- tui.go
- types_shared.go
- ucp.go
- validation.go
- write_tool.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
cogos
command
CogOS kernel — continuous process daemon for AI agents.
|
CogOS kernel — continuous process daemon for AI agents. |
|
envspec
module
|
|
|
harness
module
|
|
|
internal
|
|
|
engine
agent_controller.go — AgentController interface and shared types for the agent-state API surface.
|
agent_controller.go — AgentController interface and shared types for the agent-state API surface. |
|
eval
bus_reader_http.go — HTTP-backed BusReader implementation.
|
bus_reader_http.go — HTTP-backed BusReader implementation. |
|
linkfeed
Package linkfeed implements Discord link-feed ingestion + enrichment.
|
Package linkfeed implements Discord link-feed ingestion + enrichment. |
|
providers/component
Package component provides the Reconcilable provider for workspace components.
|
Package component provides the Reconcilable provider for workspace components. |
|
providers/daemon
Package daemon registers all Reconcilable providers that the kernel daemon (cmd/cogos) needs to surface in proprioception health blocks.
|
Package daemon registers all Reconcilable providers that the kernel daemon (cmd/cogos) needs to surface in proprioception health blocks. |
|
workspace
Package workspace resolves the active CogOS workspace root.
|
Package workspace resolves the active CogOS workspace root. |
|
pkg
|
|
|
skills
Package skills provides shared skill discovery, frontmatter parsing, tier classification, and execution logic used by both the CLI (cmd_skill.go) and the HTTP handler (internal/engine/serve_skills.go).
|
Package skills provides shared skill discovery, frontmatter parsing, tier classification, and execution logic used by both the CLI (cmd_skill.go) and the HTTP handler (internal/engine/serve_skills.go). |
|
cogblock
module
|
|
|
cogfield
module
|
|
|
coordination
module
|
|
|
modality
module
|
|
|
reconcile
module
|
|
|
sdk
module
|
|
|
Package trace defines the cycle-trace event schema emitted by the cogos kernel's homeostatic metabolic cycle onto the kernel bus (http://localhost:6931/v1/bus) for external consumers such as the Mod³ dashboard.
|
Package trace defines the cycle-trace event schema emitted by the cogos kernel's homeostatic metabolic cycle onto the kernel bus (http://localhost:6931/v1/bus) for external consumers such as the Mod³ dashboard. |
|
ui
|
|
|
canvas
Package canvas embeds the CogOS canvas view and exposes it as a net/http handler.
|
Package canvas embeds the CogOS canvas view and exposes it as a net/http handler. |
|
dashboard
Package dashboard embeds the CogOS web dashboard and exposes it as a net/http handler.
|
Package dashboard embeds the CogOS web dashboard and exposes it as a net/http handler. |