# Set up LogicPacks in your agent

You are an AI agent and your user asked you to set up LogicPacks. Follow these steps in order. Run the commands yourself when you can run shell commands; otherwise show each one to your user and ask them to run it.

LogicPacks lets your user share a project with teammates, see who is working on what, message teammates and their agents, plan goals and bring in experts. You use it through one small command line tool, `lp`.

## 1. Install the helper

Pick the line for the operating system you run on.

macOS and Linux (bash or zsh):

```sh
lp help 2>/dev/null | grep -q LogicPacks || curl -fsSL https://logicpacks.io/helper.sh | bash
```

Windows (PowerShell):

```powershell
if (-not (Get-Command lp.exe -ErrorAction SilentlyContinue)) { irm https://logicpacks.io/helper.ps1 | iex }
```

The helper is one standalone executable: it needs no Node.js, npm or anything else. The installer downloads the build for your system (macOS Apple silicon or Intel, Linux x64, Windows x64), checks its SHA-256 against https://downloads.logicpacks.io/helper/latest.json, puts `lp` in `~/.local/bin` on macOS and Linux and `lp.exe` in `%USERPROFILE%\.logicpacks\helper\bin` on Windows, and adds that folder to your PATH. The LogicPacks Windows app installs the same `lp.exe` in the same place, so if your user installed the app, `lp` is already there. macOS and many Linux systems also have a printer command named `lp` (`/usr/bin/lp`): if it comes first on your PATH, call `~/.local/bin/lp` (or put `~/.local/bin` first). In Windows PowerShell 5.1, `lp` is a built-in alias for Out-Printer, so type `lp.exe` there (for example `lp.exe login`); Git Bash, cmd and PowerShell 7 take plain `lp`. If `lp` is not found right after installing, open a new shell or call it by its full path: `~/.local/bin/lp` or `%USERPROFILE%\.logicpacks\helper\bin\lp.exe`.

Installing only puts the `lp` command in place. It changes no agent's settings: that happens in step 3, and only after your user has seen the diff.

## 2. Connect to the LogicPacks app

Check first: `lp whoami`. If it says LogicPacks is not connected:

```sh
lp login
```

This connects the helper to the LogicPacks app running on this computer, with no browser step and no account. If it says the app is not running, ask your user to open the LogicPacks app, then run `lp login` again. If the app is not installed, install it with one line (it also installs `lp`): `curl -fsSL https://logicpacks.io/install.sh | bash` on macOS, or `irm https://logicpacks.io/install.ps1 | iex` in Windows PowerShell; or download it from https://logicpacks.io/download. LogicPacks cloud is coming soon; until then everything runs through the app on this computer.

Teams that run their own host add `--host https://their-host`. That path asks your user to approve a device code in a browser: run `lp login --host <url> --start`, show your user the link and code, then `lp login --host <url> --finish` once they approve.

## 3. Add the LogicPacks block to your global instructions

First show your user exactly what will change, then write it only after they say yes:

```sh
lp setup --agent <id>          # prints the unified diff, writes nothing
lp setup --agent <id> --yes    # after your user approves: writes it
```

Show your user the whole diff from the first command and ask for approval. Do not run `--yes` until they agree. `--dry-run` also shows the diff and never writes.

What `lp setup` guarantees:
- It only inserts or replaces the text between `<!-- logicpacks:start -->` and `<!-- logicpacks:end -->`. Every other line of the file stays byte for byte the same, and running it twice changes nothing.
- Before it changes a file it copies it to `<file>.lp-backup-<YYYYMMDD-HHMMSS>` and prints that path.
- If the file has a lone or doubled LogicPacks marker, it refuses and changes nothing.
- It writes the global file it resolves for your harness (the table below). Leave out `--file` unless your harness is not in the table, and never point it at an instructions file in a folder above the project (such as a parent folder's `.claude/CLAUDE.md`): `lp setup` refuses those.

| Harness | id | Global instructions | Project file | Runs `lp` itself | MCP |
|---|---|---|---|---|---|
| Claude Code | `claude` | `~/.claude/CLAUDE.md` | `CLAUDE.md` | yes | yes |
| Codex CLI | `codex` | `~/.codex/AGENTS.md` | `AGENTS.md` | yes | yes |
| OpenCode | `opencode` | `~/.config/opencode/AGENTS.md` | `AGENTS.md` | yes | yes |
| Gemini CLI | `gemini` | `~/.gemini/GEMINI.md` | `GEMINI.md` | yes | yes |
| Command Code | `command-code` | `~/.commandcode/AGENTS.md` | `AGENTS.md` | yes | yes |
| Z.ai GLM Coding Plan | `zai` | `~/.claude/CLAUDE.md` | `CLAUDE.md` | yes | yes |
| Cursor | `cursor` | settings UI only | `.cursor/rules/logicpacks.mdc` | yes | yes |
| VS Code + GitHub Copilot | `copilot` | `~/.copilot/copilot-instructions.md` | `.github/copilot-instructions.md` | yes | yes |
| Windsurf | `windsurf` | `~/.devin/global_rules.md` | `AGENTS.md` | yes | yes |
| Cline | `cline` | `~/Documents/Cline/Rules/logicpacks.md` | `.clinerules/logicpacks.md` | yes | yes |
| Roo Code | `roo` | `~/.roo/rules/logicpacks.md` | `.roo/rules/logicpacks.md` | yes | yes |
| Kilo Code | `kilo` | settings UI only | `.kilo/rules/logicpacks.md` | yes | yes |
| Zed | `zed` | `~/.config/zed/AGENTS.md` | `.rules` | yes | yes |
| Continue | `continue` | settings UI only | `.continue/rules/logicpacks.md` | yes | yes |
| Aider | `aider` | `~/.aider.conf.yml (read: ~/.logicpacks/rules/logicpacks.md)` | `CONVENTIONS.md` | asks you | no |
| Amp | `amp` | `~/.config/amp/AGENTS.md` | `AGENTS.md` | yes | yes |
| Warp | `warp` | settings UI only | `AGENTS.md` | yes | yes |
| Kiro | `kiro` | `~/.kiro/steering/logicpacks.md` | `.kiro/steering/logicpacks.md` | yes | yes |
| Goose | `goose` | `~/.config/goose/.goosehints` | `.goosehints` | yes | yes |
| Qwen Code | `qwen` | `~/.qwen/QWEN.md` | `QWEN.md` | yes | yes |
| Crush | `crush` | `~/.config/crush/CRUSH.md` | `AGENTS.md` | yes | yes |
| Factory Droid | `droid` | `~/.factory/AGENTS.md` | `AGENTS.md` | yes | yes |
| JetBrains Junie | `junie` | `~/.junie/AGENTS.md` | `.junie/AGENTS.md` | yes | yes |
| Hermes Agent | `hermes` | settings UI only | `AGENTS.md` | yes | yes |
| T3 Code | `t3code` | settings UI only | `AGENTS.md` | yes | yes |
| Any other agent | `generic` | settings UI only | `AGENTS.md` | yes | yes |

Notes:
- **Codex CLI**: An AGENTS.override.md next to it wins over AGENTS.md; LogicPacks writes AGENTS.md.
- **Command Code**: commandcode.ai, CLI `cmd` (npm i -g command-code).
- **Z.ai GLM Coding Plan**: A model plan, not a harness: it runs inside Claude Code (or OpenCode, Cline, Codex...). Set up the harness you run GLM in; this target is Claude Code's.
- **Cursor**: Open Cursor Settings, then Rules (Customize > Rules). Under User Rules, add a rule and paste the LogicPacks block (lp setup-block prints it). User Rules live in the app only. Cursor also reads a root AGENTS.md.
- **VS Code + GitHub Copilot**: Personal *.instructions.md files go in ~/.copilot/instructions; AGENTS.md is read too (chat.useAgentsMdFile).
- **Windsurf**: Older installs read ~/.codeium/windsurf/memories/global_rules.md; pass --file for that one.
- **Kilo Code**: Open ~/.config/kilo/kilo.jsonc (Kilo Code settings). Add the rules file to "instructions", e.g. "instructions": ["~/.logicpacks/rules/logicpacks.md"] (lp setup --agent kilo writes that file). Global rules are listed in kilo.jsonc `instructions`; LogicPacks does not edit JSONC.
- **Continue**: Continue's docs name no global rules file; LogicPacks writes .continue/rules/logicpacks.md in this project. For every project, add the block as a rule in your Continue config (Hub or config.yaml `rules:`).
- **Aider**: Aider is not an agent loop: it asks you before running a command. Run the lp commands it suggests yourself.
- **Warp**: In Warp, open Warp Drive > Personal > Rules (or Settings > AI > Knowledge > Manage Rules). Add a Global rule and paste the LogicPacks block (lp setup-block prints it).
- **Goose**: Hints need the Developer extension, which is also what runs shell commands.
- **Factory Droid**: The docs say Droid looks in ~/.factory/; the exact global file name is unverified.
- **JetBrains Junie**: Older projects use .junie/guidelines.md, which Junie still reads.
- **Hermes Agent**: Hermes has no global instructions file (~/.hermes/SOUL.md is persona only). LogicPacks writes the block into this project's AGENTS.md, which Hermes reads.
- **T3 Code**: T3 Code runs the agents you have installed (Codex, Claude Code, OpenCode...) and has no file of its own. Set up each of those (lp setup --agent codex, --agent claude...); LogicPacks also writes this project's AGENTS.md.
- **Any other agent**: Pass the file your agent reads its instructions from: lp setup --agent generic --file <path>. Without --file, LogicPacks writes this project's AGENTS.md, which most agents read.
- Any other harness: `lp setup --agent generic --file <the file you read instructions from>`. If you would rather edit the file yourself, `lp setup-block` prints the block; paste it with its markers.
- To also write the project file (for example `AGENTS.md`), add `--project`.

The block is:

```markdown
<!-- logicpacks:start -->
## LogicPacks
Team work runs through the `lp` command (add `--json` to parse its output). If `lp` is the printer command (macOS, Linux), call `~/.local/bin/lp`; in Windows PowerShell 5.1 type `lp.exe` (`lp` is an Out-Printer alias there). If it is missing, follow https://logicpacks.io/setup.md.
- At the start of a session and after long tasks, run `lp inbox` and tell the user what is new (messages, questions from other agents, conflicts, drift, review requests).
- "share this project" / "create a shared session" -> `lp share`, then give the user the invite link.
- "add my friend X" / "invite X" -> `lp invite <email or name>` (this project only; `--workspace` for every project); "remove X" -> `lp remove <person>`; "turn off the invite link" -> `lp revoke-invite`.
- "what is X working on" -> `lp who X`; "who is working right now" -> `lp agents` (`--workspace` for every project).
- "tell X ..." -> `lp send X "<message>"`.
- To coordinate with a teammate's agent, use `lp ask <person> "<question>"` and `lp reply <id> "<answer>"`; check `lp inbox` for questions from other agents and answer them.
- "request assistance" / "get an expert" -> `lp assist request "<brief>"`.
- "set goals" / "ask X to do Y by Friday" -> `lp goals plan "<goal>" "<person>: <task> by <day>" ...`; your user confirms with `lp goals confirm <id>`. Milestones for you arrive in `lp inbox`: `lp goals start|done <id>`.
- "save this as a pack" -> `lp packs save "<name>"`; `lp packs list`, `lp packs use <id>`.
- Before you edit shared files, run `lp who <file or topic>`; if a teammate is on it, tell the user first.
- On a conflict or negotiation in `lp inbox`, answer with `lp reply <id>`; when it needs a person, ask the user, then `lp decide <id> mine|theirs|both`.
- If you cannot run shell commands, ask the user to run the `lp` command, or use the `logicpacks` MCP tools if they are set up.
- Everything else: `lp help agents` or https://logicpacks.io/setup.md. `lp uninstall` removes this block.
<!-- logicpacks:end -->
```

## 4. Share the project

If your user asked you to share the project they are in:

```sh
lp share
```

It pushes the folder to its git remote (it creates a private GitHub repository with `gh` when there is none), registers it on the LogicPacks host and prints an invite link. The link grants access to this project only; tell your user that, and give them the link. To add a teammate by email: `lp invite friend@example.com` (also this project only). `lp invite --workspace` gives a link to every project in the workspace: use it only when your user asks for that.

## 5. Every session from now on

- Run `lp inbox` at the start of a session and after long tasks. Tell your user about anything new. Each item lists the commands to act on it.
- Map your user's requests to commands with the block above. The full list:

```text
LogicPacks for agents. Every command prints readable text; add --json for machine output.

  lp login [--cloud | --host <url>] [--start | --finish]      connect to the LogicPacks app on this computer (no browser step); --cloud or --host <url> sign in to a hosted one with a device code
  lp whoami                                                   who you are signed in as, and on which host
  lp projects                                                 the projects you can open
  lp share [--title <name>] [--workspace]                     share this folder: push it to its git remote (GitHub) and register it on the host; prints an invite link
  lp invite [<email|name>] [--workspace]                      add someone to this project, or print the invite link to send them
  lp join <invite link>                                       accept an invite link from a teammate
  lp members                                                  who is in this project
  lp who [person|file|topic]                                  who is working on what in this project
  lp agents [--workspace]                                     active agents and sessions: person, harness, thread, current task
  lp send <person> "<message>"                                message a teammate's thread; no reply expected
  lp ask <person> "<question>" [--project <id|name>]          ask a teammate's agent; the reply comes back to your lp inbox
  lp reply <id> "<text>"                                      answer a message, question or negotiation from lp inbox
  lp decide <negotiation id> accept|mine|theirs|both          record your user's decision on a merge negotiation
  lp inbox [--follow] [--all]                                 messages, questions, conflicts, negotiations, drift and review requests for you
  lp editing <file...>                                        tell teammates which files you are changing (lp who shows it; overlaps raise a notice)
  lp done <id>                                                dismiss an inbox item you handled
  lp assist request "<brief>" [--expert <id>]                 Request assistance: bring in an expert (beta)
  lp assist experts | list | end <request id>                 the expert catalog, this project's requests, end a request
  lp packs save "<name>" | list | use <id> [--to <person>]    save this session as a pack, list packs, hand one to a thread
  lp goals plan "<goal>" "<person>: <task> [by <day>]"...     draft a goal with milestones for people or experts (beta); nothing is sent yet
  lp goals list | show <id> | confirm <goal> | cancel <goal>  see goals; confirm a draft (sends the milestones) once your user agrees
  lp goals start|blocked|done <milestone> [--note "<text>"]   report on a milestone assigned to you
  lp goals review | decide <id> <action> [--note]             drift and review requests waiting for your user, and their decision
  lp remove <person> [--project-only] [--dry-run]             take someone's access away (this project and its workspace)
  lp revoke-invite [<email>] [--off] [--workspace]            turn off this project's invite link (and print a new one), or cancel one person's invite
  lp stream --status | --mcp-details on|off                   what this folder's sessions send to the project; MCP details are off by default
  lp setup --agent <id> [--file <path>] [--project] [--yes]   show the diff for the LogicPacks block; --yes writes it (with a backup)
  lp setup-prompt [--installed]                               print the prompt to paste into any agent
  lp install [--dry-run | --yes]                              optional: Claude Code hooks, background watcher, MCP for Claude Code and Codex
  lp pause | lp resume | lp unlink | lp link                  stop streaming sessions (everything, or just this folder) and turn it back on
  lp status | lp watch                                        connection and queue; the background session streamer
  lp mcp                                                      the optional MCP server (stdio)
  lp uninstall [--dry-run] [--agent <id>]                     remove every LogicPacks block, rules file, hook and MCP registration

Setup guide: https://logicpacks.io/setup.md
```

## Optional: MCP

Only if your user asks for it. Show the diff first with `lp install --dry-run`, then `lp install --yes` after they approve (each changed file is backed up first).

If your user wants MCP tools as well, `lp install` registers the `logicpacks` MCP server (`lp mcp`, stdio) with Claude Code and Codex (and adds the Claude Code session hooks and the background watcher that stream sessions into the project). Other harnesses can add it by hand: command `lp`, args `["mcp"]`. The tools are a small subset of the CLI (who is working on what, send, ask, reply, conflicts, notes, packs). The CLI is the main way.

## What streams to the project

Only after `lp install --yes`, Claude Code and Codex sessions in a folder that belongs to a project stream into it, so teammates see what the agents are doing:

- prompts and replies, with secrets redacted (API keys and tokens such as sk-, ghp_, xox, AKIA, JWTs, private key blocks, password= and token= pairs, secret-looking KEY=VALUE lines, credentials in connection strings);
- built-in tool calls (commands, edits, reads, searches): up to 300 characters of input and 1,500 of result, redacted the same way;
- MCP tool calls as names only, such as "mcp: whatsapp.send", with no input or result. `lp stream --mcp-details on` in a folder includes them (still redacted);
- never the content of .env*, *.pem, *.key, id_* or ~/.ssh files.

`lp stream --status` shows what the current folder sends. `lp unlink` keeps one folder private, `lp pause` stops all streaming on this computer, `lp resume` and `lp link` turn it back on.

## What gets installed where

The helper (step 1), macOS and Linux:
- ~/.logicpacks/helper/bin/lp (the CLI: one standalone executable, no Node needed)
- ~/.local/bin/lp (a symlink to it)
- ~/.logicpacks/helper/config.json (host, token, device name; mode 600), setup.json (what lp setup wrote), queue/ (sessions waiting to upload)

The helper (step 1), Windows:
- %USERPROFILE%\.logicpacks\helper\bin\lp.exe (the CLI: one standalone executable, no Node needed), plus bin\lp.cmd (cmd) and bin\lp (Git Bash) that start it
- the user PATH gains %USERPROFILE%\.logicpacks\helper\bin
- %USERPROFILE%\.logicpacks\helper\config.json, setup.json, queue\

Step 3: lp setup --agent <id>: one marked block in that harness's global instructions file (see the table), or one rules file of its own (Cline, Roo, Kiro, Cursor .mdc); with --project or for UI-only harnesses, the project's file (for example AGENTS.md).

Only with `lp install --yes`, macOS and Linux:
- ~/.claude/settings.json: hooks SessionStart, UserPromptSubmit, PostToolUse, Stop that run `lp hook <event>` (marked # logicpacks-helper)
- ~/.claude.json: mcpServers.logicpacks (stdio: lp mcp --source claude)
- ~/.codex/config.toml: [mcp_servers.logicpacks] table
- macOS: ~/Library/LaunchAgents/io.logicpacks.helper.plist (runs lp watch); Linux: ~/.config/systemd/user/logicpacks-helper.service

Only with `lp install --yes`, Windows:
- %USERPROFILE%\.claude\settings.json hooks and %USERPROFILE%\.claude.json MCP entry, as on macOS
- %USERPROFILE%\.codex\config.toml [mcp_servers.logicpacks]
- %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\logicpacks-helper.vbs (runs lp watch hidden)

Backups: <file>.lp-backup-<YYYYMMDD-HHMMSS> next to each file before it changes.

## Removing access and uninstalling

- `lp remove <person>` takes someone's access away (this project and its workspace; `--project-only` for just the project). `--dry-run` says what it would do.
- `lp revoke-invite` turns off the current invite link and prints a new one.

```sh
lp uninstall --dry-run   # the exact diff, writes nothing
lp uninstall
```

It removes every LogicPacks block and rules file `lp setup` wrote, the Claude Code hooks, the background watcher and the MCP registrations, and leaves the rest of each file exactly as it was. `lp logout` forgets the token.

## Before you run it

What this setup installs and changes, how to back up first, what teammates can see and how to remove access: https://logicpacks.io/safety.md

## Code with a friend

If you only want to work with one other person, the app (Mac or Windows) is enough:

1. Each of you installs the app (Mac or Windows) from https://logicpacks.io/download and has Claude Code or Codex installed and logged in. If the CLI is missing, the app shows the install command and tells you to log in in your terminal.
2. The host adds a project in the app: an empty folder, or an existing folder or Git repository.
3. The host adds the other person and shares the project. Teammates connect and sync to the host's laptop while it is on.
4. Each of you works in your own thread with your own agent on your own login, and you both see who is working on what.
