Files
archie/config.example.toml
T
sam bf5a7618e6 fix(chat): operator name from config, session wiring, prompt rules
Three defects found from a real Telegram transcript.

1. The operator's name was compiled into the prompt.

internal/gateway/persona.go and prompt.go both hardcoded "Sam's" into the
default persona and the fallback prompt. The persona renders first into
every system prompt, so a personal name was sent to the model provider on
every turn, and any other deployment got an assistant that believed it
worked for someone else. There was nowhere to put it: Repo.Owner is a repo
owner and config.Config had no operator concept.

ChatConfig.Operator now carries it, rendered in the prompt's <env> block as
runtime metadata and omitted entirely when unset. config.example.toml
documents that setting it sends the name to the model provider.

2. /new claimed to clear history that it had not cleared.

The chat responder keyed history by channel id through a local sessionKey
helper, while the session commands operate on tracked session ids.
sessionTracker.resolve mints deterministic ids so the two agree -- until
/new, /branch or /resume assigns a generated id, after which they address
different histories permanently. /new reported "Conversation history has
been cleared" while the next turn still saw everything, and /undo,
/compress, /resume and /sessions acted on a namespace the conversation
never read.

gateway.Router.ResolveSessionKey already existed for this, and
session_commands.go:104 said outright that main.go should call it instead of
its inline helper. It never got wired. The responder now resolves through
the router and the dead helper is deleted so it cannot come back.

buildTelegramRouter constructs the router before the responder so the
dependency is visible rather than captured by reference.

3. Prompt rules for two behaviours the transcript showed.

The agent offered to accept shell access it has no tool to use, which is
both unhonourable and a request for the user's secrets. It also opened
mid-conversation replies with a greeting, and described its own manner
("no fluff") in stock phrasing. Added core rule 7 and three communication
rules covering greetings, self-description and register.

Note the memory claim in that transcript was NOT a fabrication: the
memory_edit tool's own description names MEMORY.md and USER.md, and tool
descriptions are part of the prompt.

Also added chat-turn logging (session id, channel, thread, history depth).
Chat turns were entirely unlogged, so a report of lost context had no
evidence to check: 76 log lines covered two days and none of them was a
conversation. A separate report of mid-conversation amnesia remains
undiagnosed -- single process, 43h uptime, compression untriggered at three
messages -- and this is what makes it diagnosable next time.

Regression tests: prompt renders/omits the operator and carries no personal
name; the responder resolves via ResolveSessionKey and defines no local
session key helper.

Verified: go build, go vet, gofmt clean; full suite passes.
2026-07-29 15:17:23 +10:00

134 lines
5.2 KiB
TOML

# archied configuration. Copy to ~/.config/archie/config.toml.
# Secrets are NOT configured here directly: each one is a {engine, key}
# reference resolved through a secrets engine at startup. The built-in
# "env" engine reads key as an environment variable name. Custom engines
# (sops, bws, vault/openbao, ...) are Yaegi plugins loaded from a
# directory -- see internal/secret.
# work_dir = "~/.local/share/archie/work" # default
# db_path = "~/.local/share/archie/archie.db"
poll_interval = "60s"
label = "archie"
bot_user = "vectis-labs-archie"
diff_cap_lines = 400
# max_retries = 3 # how many times a parked task is retried before permanent park (global default; set per-repo to override)
[forge]
type = "github"
host = "https://github.com"
token = { engine = "env", key = "ARCHIE_GITHUB_TOKEN" }
[dispatch]
trigger = "assignee" # "assignee", "label", or "either"
ack_reaction = "eyes" # "off" disables pickup reactions
[dispatch.labels]
queued = "archie:queued"
working = "archie:working"
waiting = "archie:waiting"
pr = "archie:pr"
parked = "archie:parked"
# dead = "archie:dead" # applied when a task exhausts max_retries
[models] # role -> ai-sdk runtime ref (used by agent workflows, Phase 4b)
triage = "openai/gpt-5.4"
planner = "openai/gpt-5.4"
builder = "openai/gpt-5.4"
[providers.openai]
class = "openai"
api_key_env = "OPENAI_API_KEY"
[providers.ollama]
class = "ollama"
# Optional interactive-chat catalog. /provider groups these references by
# their first path segment, and /model shows only the selected provider's
# entries. When omitted, Archie uses the distinct refs in [models].
#
# `operator` is the display name of the person this deployment assists. It is
# passed to the chat agent as runtime metadata, which means it is sent to the
# configured model provider on every turn -- leave it unset to tell the agent
# nothing about who is running it.
# [chat]
# operator = "Ada Lovelace"
# models = [
# "openai/gpt-5.6-sol",
# "openrouter/openai/gpt-5.6-sol",
# ]
# Optional self-hosted update adapter. Both values are argv arrays (never
# shell snippets). The check command must write a releaseupdate.Snapshot JSON
# document to stdout; configure the installer as well to show Approve/Defer.
# [chat.telegram]
# update_check_command = ["/usr/local/bin/archie-update-check"]
# update_install_command = ["/usr/local/bin/archie-update-install"]
# External MCP tools are launched and managed by Archie's MCP client.
# [[tools.mcp_servers]]
# name = "desktop-commander"
# transport = "stdio"
# command = "npx"
# args = ["-y", "@wonderwhy-er/desktop-commander@0.2.46", "--no-onboarding"]
# work_dir = "/path/to/workspace"
[agent]
mode = "inprocess" # "subprocess" runs each stage through archie-agent (stdin/stdout); "nats" sends stages over NATS
command = "archie-agent" # executable path for subprocess mode (not used in nats mode)
# Subprocess mode isolates the protocol and process lifecycle, not OS privileges.
# The worker still runs as the daemon user until the Docker sandbox phase lands.
# env = ["GOCACHE"] # extra environment variable names forwarded to the worker
[indexing] # workspace codesearch index; both paths default under work_dir
# index_dir = "/var/lib/archie/indexes" # codesearch sidecar files
# db_path = "/var/lib/archie/workspace-indexes.db" # index lifecycle metadata
[web] # observability dashboard (read-only, no auth -- keep it local/tailnet)
listen = "127.0.0.1:8484" # "off" disables
[notify] # optional webhook for human-in-the-loop moments (n8n -> email)
# webhook = "https://n8n.catlow.cloud/webhook/archie"
[budgets]
max_steps = 60
max_tokens = 400000
wall_clock = "30m"
gate_max_failures = 5
# NATS JetStream for distributed task queue. Remove or leave commented out
# to run in single-process SQLite mode.
# [nats]
# url = "nats://localhost:4222"
# token_env = "NATS_TOKEN" # optional; named variable must be set
# Docker sandbox execution of archie-agent. Requires [nats] and agent.mode = "nats".
# [containers]
# enabled = true
# image = "archie-agent:latest" # Docker image to run
# max_concurrency = 4 # max simultaneous tasks/containers
# max_uptime = "60m" # container lifetime cap
# volume_ttl = "72h" # max age for persistent repo volumes and Git clone caches
# pull_policy = "missing" # "missing" or "always"
[[repos]]
owner = "samcharles93"
name = "todo"
base = "main"
ecosystem = "go" # "go", "python", "node", "rust", or "custom"
# Override the ecosystem defaults when needed:
# preflight = [["go", "version"]]
# test_glob = "*_test.go"
protect = ["_templ.go"]
gate = [
["templ", "generate", "./components/"],
["go", "vet", "./..."],
["go", "build", "./..."],
["golangci-lint", "run"],
["go", "test", "./...", "-count=1"],
]
# allow_concurrent = true # let the daemon run multiple tasks for this repo at once instead of
# FIFO-serializing them; only safe when concurrent worktrees won't collide
# (e.g. different base branches or packages per task). Still bounded by
# [containers].max_concurrency globally.
# persistent_storage = true # reuse a per-repo Docker volume and Git object cache until volume_ttl