Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(agent): let the delegate display name define its identity

muterCfb2e1537d2d0
diff --git a/apps/teamhub/AGENTS.md b/apps/teamhub/AGENTS.md
index 03847fc5..bd67a685 100644
--- a/apps/teamhub/AGENTS.md
+++ b/apps/teamhub/AGENTS.md
@@ -41,6 +41,9 @@ Go service owning Human HTTP/SSE, Agent callbacks, and active product state.
- The Human's default Another Me Agent is named `Linger`. Changing the Human's
name updates the delegate description, never the Agent's display name.
A forward migration renames generated names; custom Agent names stay.
+ The instruction template describes the delegate's role without overriding
+ its display name. Template migrations preserve custom instructions and
+ advance only the profile configuration revision.
- Gmail canvas drafts persist their source digest alongside the provider draft ID.
Preparing and executing a send confirmation both check the current authorized
canvas against that source; changed recipients, body, or attachments require a
diff --git a/apps/teamhub/internal/agentregistry/another_me.go b/apps/teamhub/internal/agentregistry/another_me.go
index b3a8c864..0fade339 100644
--- a/apps/teamhub/internal/agentregistry/another_me.go
+++ b/apps/teamhub/internal/agentregistry/another_me.go
@@ -29,7 +29,7 @@ import (
// the Human has no Another Me, and nothing waits or polls for the Computer.
// A change to the template reaches existing Another Mes through a migration.
const (
- anotherMeInstructions = `You are Another Me, a private delegate for the Human you represent. Help them organize work, coordinate with other Agents, and act only within explicit TeamHub authority. Never claim to be the Human, never inherit external credentials implicitly, and ask for approval whenever required by product policy.`
+ anotherMeInstructions = `You are a private delegate for the Human you represent. Help them organize work, coordinate with other Agents, and act only within explicit TeamHub authority. Never claim to be the Human, never inherit external credentials implicitly, and ask for approval whenever required by product policy.`
anotherMeGreeting = "Hi %s, I'm Linger — your personal AI."
anotherMeChatName = "Chat"
diff --git a/apps/teamhub/migrations/00881_use_delegate_display_name_in_instructions.sql b/apps/teamhub/migrations/00881_use_delegate_display_name_in_instructions.sql
new file mode 100644
index 00000000..0d88cb58
--- /dev/null
+++ b/apps/teamhub/migrations/00881_use_delegate_display_name_in_instructions.sql
@@ -0,0 +1,13 @@
+-- +goose Up
+-- The Agent's display name owns its identity; the template only describes its role.
+UPDATE agent_registrations
+SET instructions = 'You are a private delegate for the Human you represent. Help them organize work, coordinate with other Agents, and act only within explicit TeamHub authority. Never claim to be the Human, never inherit external credentials implicitly, and ask for approval whenever required by product policy.',
+ configuration_revision = configuration_revision + 1,
+ updated_at = now()
+WHERE agent_type = 'anotherme'
+ AND instructions = 'You are Another Me, a private delegate for the Human you represent. Help them organize work, coordinate with other Agents, and act only within explicit TeamHub authority. Never claim to be the Human, never inherit external credentials implicitly, and ask for approval whenever required by product policy.';
+
+-- +goose Down
+-- +goose StatementBegin
+DO $$ BEGIN RAISE EXCEPTION 'the delegate identity template is forward-only'; END $$;
+-- +goose StatementEnd
diff --git a/apps/teamhub/tests/integration/another_me_instructions_migration_test.go b/apps/teamhub/tests/integration/another_me_instructions_migration_test.go
new file mode 100644
index 00000000..97493d68
--- /dev/null
+++ b/apps/teamhub/tests/integration/another_me_instructions_migration_test.go
@@ -0,0 +1,79 @@
+package integration_test
+
+import (
+ "strings"
+ "testing"
+
+ "github.com/simplexai-labs/linger/apps/teamhub/migrations"
+)
+
+func TestAnotherMeInstructionsMigrationPreservesCustomIdentityAndRuntime(t *testing.T) {
+ allowParallelIntegrationTest(t)
+ const oldInstructions = "You are Another Me, a private delegate for the Human you represent. Help them organize work, coordinate with other Agents, and act only within explicit TeamHub authority. Never claim to be the Human, never inherit external credentials implicitly, and ask for approval whenever required by product policy."
+ data, err := migrations.Files.ReadFile("00881_use_delegate_display_name_in_instructions.sql")
+ if err != nil {
+ t.Fatal(err)
+ }
+ migration, _, found := strings.Cut(string(data), "-- +goose Down")
+ if !found {
+ t.Fatal("migration has no Down boundary")
+ }
+ for _, test := range []struct {
+ name, displayName, instructions string
+ general bool
+ }{
+ {name: "default identity", displayName: "Linger", instructions: oldInstructions},
+ {name: "custom name", displayName: "Helper", instructions: oldInstructions},
+ {name: "custom instructions", displayName: "Helper", instructions: "Coordinate my research safely."},
+ {name: "general Agent", displayName: "Researcher", instructions: oldInstructions, general: true},
+ } {
+ t.Run(test.name, func(t *testing.T) {
+ env, _, _ := newAnotherMeEnv(t)
+ actorID := connectAnotherMeComputer(t, env, acmeTenant, "actor_acme_alice")
+ var template string
+ if err := env.pool.QueryRow(t.Context(), `SELECT instructions FROM agent_registrations WHERE actor_id=$1`, actorID).Scan(&template); err != nil {
+ t.Fatal(err)
+ }
+ if !strings.HasPrefix(template, "You are a private delegate for the Human you represent.") {
+ t.Fatalf("new Agent template overrides its identity: %q", template)
+ }
+ if test.general {
+ if err := env.pool.QueryRow(t.Context(), `SELECT actor_id FROM agent_registrations WHERE tenant_id=$1 AND agent_type='general' ORDER BY actor_id LIMIT 1`, acmeTenant).Scan(&actorID); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if _, err := env.pool.Exec(t.Context(), `UPDATE actors SET display_name=$2 WHERE id=$1`, actorID, test.displayName); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := env.pool.Exec(t.Context(), `UPDATE agent_registrations SET instructions=$2 WHERE actor_id=$1`, actorID, test.instructions); err != nil {
+ t.Fatal(err)
+ }
+ var profileRevision, runtimeRevision int64
+ if err := env.pool.QueryRow(t.Context(), `SELECT configuration_revision, runtime_configuration_revision FROM agent_registrations WHERE actor_id=$1`, actorID).Scan(&profileRevision, &runtimeRevision); err != nil {
+ t.Fatal(err)
+ }
+ wantInstructions := test.instructions
+ if !test.general && test.instructions == oldInstructions {
+ wantInstructions = template
+ profileRevision++
+ }
+ for attempt := 0; attempt < 2; attempt++ {
+ if _, err := env.pool.Exec(t.Context(), migration); err != nil {
+ t.Fatal(err)
+ }
+ var name, instructions string
+ var gotProfileRevision, gotRuntimeRevision int64
+ if err := env.pool.QueryRow(t.Context(), `
+ SELECT actor.display_name, registration.instructions, registration.configuration_revision, registration.runtime_configuration_revision
+ FROM actors actor JOIN agent_registrations registration ON registration.actor_id=actor.id
+ WHERE actor.id=$1
+ `, actorID).Scan(&name, &instructions, &gotProfileRevision, &gotRuntimeRevision); err != nil {
+ t.Fatal(err)
+ }
+ if name != test.displayName || instructions != wantInstructions || gotProfileRevision != profileRevision || gotRuntimeRevision != runtimeRevision {
+ t.Fatalf("migration attempt %d: name=%q instructions=%q revisions=%d/%d; want %q, %q, %d/%d", attempt+1, name, instructions, gotProfileRevision, gotRuntimeRevision, test.displayName, wantInstructions, profileRevision, runtimeRevision)
+ }
+ }
+ })
+ }
+}