Codex, a coder in every chat

Codex is OpenAI's coding agent, and Link runs it as a harness over its ACP adapter, in Link's sandbox, with your OpenAI or OpenRouter key.

lnk agent start --model openai/gpt-5   # paste your OpenAI key when it asks
lnk agent use --harness codex           # installs it, then starts it with your settings
lnk agent connect telegram    # text it from your phone

Use a model

It uses the model your agent has: an OpenAI or OpenRouter model with your API key, or a model on your computer whose runtime answers the Responses API, as Ollama does. It takes no model from another hosted provider.

Talk to it

It speaks no connection itself, so Link carries Telegram, Slack, Discord and Signal to it, as it does for Link Harness. Each chat is a Codex session of its own, behind an endpoint of this adapter's.

Link installs it, gives it settings of its own, writes who the agent is into its instructions and runs it behind an endpoint of its own.

It installs it

Link installs Node from nodejs.org, checked against the SHA-256 in its source, then the ACP organization's codex-acp from npm at the version it pins, Codex with it. Both go in ~/.lnk/codex in the harness's home.

It gives it settings

Codex's own folder is ~/.lnk/codex/codex, never your ~/.codex. Link sets its model as a provider of its own, its mode that never asks, and no update checks or analytics in its config.toml, keeping every other key you set there. Your tools and memory go with each conversation, as its MCP servers, never into config.toml.

It writes who the agent is

The agent's persona, owner and standing instructions go in a Link block of that folder's AGENTS.md, written at each start. What you write outside the block stays yours.

It runs it behind an endpoint

lnk-codex serve answers ACP on port 18840, through the harness hub, with one codex-acp behind it that it starts again if it stops. The model's key reaches it in its environment, never on a command line.

Switch to and from it

lnk agent use --harness codex switches an agent to it, and another lnk agent use back. It carries no conversations over ASP yet, so a switch names its conversations as left behind, in Link's folder as they were.

Files it keeps

What Link writes in the harness's home for it, beside Codex's own files.

.lnk/codex/link.env

The endpoint's key and the model's, mode 600 in <harness home>, written at each start.

.lnk/codex/threads.json

Each chat's session in <harness home>, so a chat goes on where it was after a restart.

More about it

Troubleshooting says what to do when it fails, Decisions why it works this way and Security what it may do. The other lnk agent commands are on the Agents page.

Build and test

It depends on link-plugin from the core, beside it in the public workspace.

cargo fmt --check
cargo clippy --all-targets --locked -- -D warnings
cargo test --locked

Release

Link's release builds lnk-codex from this folder and ships it as one of Link's plugins, at the core's version, signed with Link's key.

License

MIT or Apache-2.0, at your option.

Docs

  • Security: What lnk-codex installs and runs, beyond what Link's sandbox guarantees every harness (Agents Security)
  • Decisions: Why lnk-codex runs Codex the way it does
  • Troubleshooting: What to do when Codex doesn't install, start or answer (Codex)