ASK ARCHIE COMPANION: START HERE

The Companion is a small program that runs on your own computer so Ask Archie can build with your own coding agent. It needs Node.js.

TWO STAGES: pairing is only the first. Pairing (step 3 below) joins this computer to your account. The Companion has to be RUNNING (the terminal window open with "node companion.js") for anything to be connected. If Ask Archie says "Paired" but not "Ready", stage two is missing: start the Companion again. Closing the terminal, or restarting the computer, stops it.

1. Install Node.js (the "LTS" version) from https://nodejs.org if you do not have it.
   To check, open a terminal (PowerShell on Windows, Terminal on Mac or Linux) and run:
       node -v
   You should see a version number. If it says "not recognised", Node.js is not installed yet, or the terminal was open before you installed it: close it, open a new one, and try again.

2. *** DO NOT SKIP THIS STEP *** Unzip this folder, open a terminal inside it, and run this once. (Some unzip tools make a folder inside a folder: open the INNER folder, the one that contains companion.js and package.json, before you run anything.)
       npm install
   What it is: the Companion uses two small helper programs (packages) that are not inside this zip. "npm install" is a tool that comes with Node.js; it reads the list in package.json and downloads those helpers into a folder called node_modules, next to companion.js. It takes a few seconds and needs the internet.
   When you need it: the first time, and again every time you unzip a Companion into a NEW folder (for example after downloading an update), because node_modules is not part of the zip. You do not need it to start the Companion again later in the same folder.
   If you skip it, starting the Companion stops with: Cannot find module 'cross-spawn'. That is the sign to run npm install.

3. In Ask Archie open Settings, Local coding, and press "Generate invite code". Then, in the terminal in this folder, run:
       node companion.js
   Paste the invite code when it asks. A tab opens on askarchie.net asking you to confirm the pairing: confirm it.

4. The Companion badge at the top of Ask Archie turns green and says Ready.

ARCHIE'S EMERGENCY CHAT MODULE: to talk to the AI on your own computer with no internet, run this in the same folder (it needs Ollama or LM Studio with a model, and works with the cable pulled):
       node companion.js chat
   It opens a chat window. Nothing you type leaves your computer. To put a shortcut on your Windows Desktop run: node companion.js chat --shortcut

To stop it: press Ctrl+C in the terminal, or press Stop device in Settings. To run it again later, just run "node companion.js" again: you do not need a new invite code.
