diff --git a/pkg/agent/commands.go b/pkg/agent/commands.go index 346b259..bdc0f86 100644 --- a/pkg/agent/commands.go +++ b/pkg/agent/commands.go @@ -177,7 +177,7 @@ func (s *agent) handleCommand(ctx context.Context, input string) bool { d := s.newDispatcher() env := []string{"OLLIE_SESSION_ID=" + s.sessionID, "OLLIE_UNAME=" + s.uname} env = append(env, s.promptEnvExtra...) - rt := BuildRuntime(cfg, d, s.cwd, env) + rt := BuildRuntime(cfg, d, s.cwd, env, s.baseLayers...) if rt.CfgBackend != "" { newBe, err := s.newBackend(rt.CfgBackend) if err != nil { diff --git a/pkg/agent/core.go b/pkg/agent/core.go index 209a411..06f3608 100644 --- a/pkg/agent/core.go +++ b/pkg/agent/core.go @@ -283,13 +283,10 @@ type AgentCoreConfig struct { PromptEnvExtra []string // Remote is the SSH target for remote execution (empty = local). Remote string - // OperationalModel is server-injected text describing the 9P/D-Bus - // interface available to the agent. Not user-configurable. - OperationalModel string - // SystemPrompt is the base system prompt text (embedded default or - // override from agent config / session creation). If empty, BuildRuntime - // uses only the agent config's prompt commands. - SystemPrompt string + // BaseLayers are the system prompt, operational model, and environment + // block prepended to the agent preamble. Stored so /agent reloads + // preserve the server-injected context. + BaseLayers []string } // agent is the Core implementation. It owns all agent and session state @@ -312,6 +309,7 @@ type agent struct { cwd string remote string // SSH target for remote execution promptEnvExtra []string // PRIME_* vars for prompt resolution + baseLayers []string // system prompt, operational model, env block — for /agent reloads startupMessages []string currentAction atomic.Pointer[actionHandle] toolCallCount atomic.Int64 @@ -479,6 +477,7 @@ func NewAgentCore(cfg AgentCoreConfig) Core { cwd: paths.ExpandHome(cfg.CWD), remote: cfg.Remote, promptEnvExtra: cfg.PromptEnvExtra, + baseLayers: cfg.BaseLayers, startupMessages: rt.Messages, newDispatcher: cfg.NewDispatcher, newBackend: cfg.NewBackend, diff --git a/pkg/agent/core_test.go b/pkg/agent/core_test.go index 5cef1cd..f185a87 100644 --- a/pkg/agent/core_test.go +++ b/pkg/agent/core_test.go @@ -2321,6 +2321,7 @@ func setupCfgDir(t *testing.T) string { t.Helper() dir := t.TempDir() t.Setenv("OLLIE_CFG_PATH", dir) + t.Setenv("OLLIE_TOOLS_PATH", filepath.Join(dir, "tools")) return dir }