Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

Pass agent instructions inline to Hermes (#2283)

Valentin Mihov560e081d8f87
diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.go
index 70f3b553a4..cdd967f392 100644
--- a/server/internal/daemon/daemon.go
+++ b/server/internal/daemon/daemon.go
@@ -1582,6 +1582,15 @@ func gcMetaForTask(task Task) (execenv.GCMeta, bool) {
return meta, true
}
+func providerNeedsInlineSystemPrompt(provider string) bool {
+ switch provider {
+ case "openclaw", "hermes":
+ return true
+ default:
+ return false
+ }
+}
+
func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot int, taskLog *slog.Logger) (TaskResult, error) {
// Refuse to spawn an agent without a workspace. An empty workspace_id
// here would make MULTICA_WORKSPACE_ID empty in the agent env, and the
@@ -1803,13 +1812,17 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot i
CustomArgs: customArgs,
McpConfig: mcpConfig,
}
- // openclaw loads its bootstrap files (AGENTS.md, SOUL.md, ...) from its own
- // workspace dir rather than the task workdir, so the AGENTS.md written by
- // execenv.InjectRuntimeConfig is never read. Pass agent instructions inline
- // via SystemPrompt so the backend can prepend them to the --message payload.
- // Other providers already surface instructions through their runtime config
- // file and don't need this.
- if provider == "openclaw" {
+ // Some providers do not reliably load the per-task runtime config files we
+ // write into the task workdir:
+ // - openclaw loads bootstrap files (AGENTS.md, SOUL.md, ...) from its own
+ // workspace dir rather than the task workdir.
+ // - hermes is driven through ACP and starts from a long-lived Hermes home;
+ // deployments that cross a wrapper/container boundary can miss the
+ // task-workdir AGENTS.md even when the prompt itself is delivered.
+ // Pass Multica-defined identity/persona instructions inline so the backend
+ // can prepend them to the turn payload instead of relying only on file
+ // discovery.
+ if providerNeedsInlineSystemPrompt(provider) {
execOpts.SystemPrompt = instructions
}
diff --git a/server/internal/daemon/daemon_test.go b/server/internal/daemon/daemon_test.go
index 7647d09f7c..d6e3f3ef76 100644
--- a/server/internal/daemon/daemon_test.go
+++ b/server/internal/daemon/daemon_test.go
@@ -177,6 +177,29 @@ func TestNewTaskSlotSemaphoreReturnsStableSlotIndexes(t *testing.T) {
}
}
+func TestProviderNeedsInlineSystemPrompt(t *testing.T) {
+ t.Parallel()
+
+ cases := []struct {
+ provider string
+ want bool
+ }{
+ {provider: "openclaw", want: true},
+ {provider: "hermes", want: true},
+ {provider: "codex", want: false},
+ {provider: "claude", want: false},
+ }
+
+ for _, tc := range cases {
+ t.Run(tc.provider, func(t *testing.T) {
+ t.Parallel()
+ if got := providerNeedsInlineSystemPrompt(tc.provider); got != tc.want {
+ t.Fatalf("providerNeedsInlineSystemPrompt(%q) = %v, want %v", tc.provider, got, tc.want)
+ }
+ })
+ }
+}
+
func TestBuildPromptContainsIssueID(t *testing.T) {
t.Parallel()