# Claude Code — Start-Session Template (Agent Arbitrage)

**Paste this at the start of each Claude Code session, then paste the task below it.**

---

You are working on Agent Arbitrage. Before doing anything, follow ALL rules in `AGENTS.md` — Section 1 (Locked Values), Section 2 (Forbidden Actions), and Section 3 (Scope) are absolute.

**Environment / .env:** `.env` is gitignored. If it is not present in this working copy, recreate it from environment variables before running anything that needs credentials. Do not print, echo, or commit `.env` contents.

**Git discipline:** Work on a feature branch, never commit directly to `main`. I deploy to production myself (merge the PR on GitHub → `git pull origin main` on the VPS → `deploy_update.sh`, which restarts services but does NOT pull). You do not deploy. When you believe the work is complete, commit to the branch and post a brief status summary — then wait.

**Documentation discipline (REQUIRED):** If a code change alters any behaviour, name, formula, threshold, constant, or data flow that is described in `Documentation/`, `AGENTS.md`, or `README.md`, update the affected doc **in the same PR** as the code change. Before committing, list which docs your changes affect and how (or state "no documented behaviour affected"). Do NOT silently let code and docs drift apart. If you discover an existing doc that is already wrong (unrelated to your change), flag it per §3 rather than fixing it inline — it may be intended behaviour the code drifted from, which is an owner decision.

**Dev log policy:** Do NOT write a dev log until I explicitly request one. When you think you're done, post a short status summary and wait — I will review, test, and may have follow-ups. The dev log is written ONCE at the very end, capturing everything that actually shipped, including iterations and corrections between your first "I think this is done" and the final approved state. Match the format of the existing entries in `Dev_Logs/`.

**READ before starting:**

- `README.md`
- `AGENTS.md`
- `Documentation/System_State.md`
- `Documentation/Data_Logic.md`
- `Documentation/Dashboard_Specification.md`
- `Documentation/Token_Management_Strategy.md`
- `Documentation/System_Architecture.md`
- `Documentation/Feature_Deals_Dashboard.md`
- `Documentation/Feature_Guided_Learning_Strategies_Intelligence.md`
- `Documentation/INFERRED_PRICE_LOGIC.md`
- The 3 most recent Dev Logs in `Dev_Logs/` (by date in filename)

**Do NOT read:**

- `xai_cache.json`, `strategies.json`, `agent_brain.json`
- any `*.log` file of any kind
- `Diagnostics/`, `tests/` (unless a task tells you to run/modify a test)
- `AgentArbitrage_BeforeGateCheckFeature2/`
- `RAW_PRODUCT_DATA.md` or any other historical document unless I ask
- anything in any `Archive/` directory unless I ask

**Workflow:** Symptoms not theories — verify against the live code before changing it. If a task's premise doesn't match what you find, stop and tell me. Respect STOP-and-confirm checkpoints in the task: post the requested output and wait for my OK before continuing.

---

### Task Description 

# Documentation Drift Audit (REPORT ONLY — no changes first pass)

**Type:** Audit / report. **Do NOT change any docs or code in this pass.** Produce a drift report; changes happen in a separate approved second pass.

## Why this exists

Documentation was maintained ad-hoc during the Jules era and is suspected to have drifted from the actual code. Some docs may be stale (code is now correct), but — critically — some docs describe *intended* behaviour that the code has since drifted away from (the `List_at`/peak-price/clamp situation is a known example: the doc held the correct intent, the code diverged). So this audit must NOT blindly "make docs match code" — that would cement bugs into the documentation. It must classify each discrepancy for owner judgment.

## Scope

Compare, claim-by-claim, the following against the actual current code on `main`:

- Every file in `Documentation/`
- `AGENTS.md` (all sections)
- `README.md`

Focus on factual/behavioural claims: file names, function names, column names, formulas, thresholds, constants, described data flows, feature behaviour, config values, and any "the system does X" statements. Ignore prose style/tone.

## Method

For each discrepancy found, record:

1. **Doc location** — file + section/heading + the specific claim.
2. **Code reality** — file + line(s) + what the code actually does.
3. **Classification** (exactly one):
   - **(a) Stale doc** — code is correct, doc is out of date → doc should be updated.
   - **(b) Code drift** — doc describes clearly-intended behaviour the code no longer matches → possible bug; code may need fixing, NOT the doc.
   - **(c) Ambiguous** — genuine disagreement where the correct behaviour is a judgment call → needs owner (Tim) decision.
4. **Recommendation** — one line on what you'd propose, but do not act on it.

## Known context to fold in (do not re-derive)

- `AGENTS.md` §4 item 9 references `Feature_Guided_Learning_Strategies_Brain.md`; the real file is `Feature_Guided_Learning_Strategies_Intelligence.md`. (Known case-(a).)
- `INFERRED_PRICE_LOGIC.md` has a companion addendum (`INFERRED_PRICE_LOGIC_ADDENDUM_seasonal_semantics.md`) capturing intended `List_at` seasonal semantics that are NOT yet implemented. When auditing peak-price/clamp claims, treat the addendum as the statement of *intended* behaviour — so mismatches there are case-(b)/(c), not case-(a). Do not flag the addendum's un-implemented items as "doc wrong."
- The `ENABLE_LIGHTWEIGHT_CEILING_CLAMP = False` gate is intentional (pending the seasonal spec) — not a drift.

## Constraints

- REPORT ONLY. No edits to docs or code. No DB or Redis commands. No deploy.
- Do not auto-resolve (b) or (c) — those are for owner review.
- Organize the report by doc file, most-consequential discrepancies first.
- If a doc is fully accurate, say so explicitly (a clean bill is useful information).
- STOP at the end with the report and wait. Corrections will be a separate task after review.



---

# Session Start - END

---

### What changed from the Jules template (reference — do not paste this section)

- **Dropped:** the "fresh high-performance sandbox" instruction — that was a Jules sandbox-reuse workaround; Claude Code doesn't have that problem.
- **Added:** explicit git/branch/deploy discipline (Claude Code can run git; Jules couldn't deploy either, but now it's stated).
- **Same:** AGENTS.md authority, the READ / Do-NOT-read lists, the dev-log-at-end policy, symptoms-not-theories, STOP checkpoints.
- **Note:** if you add a `CLAUDE.md` at repo root, Claude Code auto-loads it every session — you could move the READ/Do-NOT-read lists there so you don't paste them each time. `AGENTS.md` may also be auto-read depending on setup. Worth trying once things are wired up.

### Changes from v1 (reference — do not paste this section)

- **Added the Documentation discipline block** — the "update affected docs in the same PR" rule, with the important carve-out that pre-existing doc errors get *flagged*, not auto-fixed, because a doc may hold intended behaviour the code drifted from (owner decision).
- Everything else unchanged from v1.



---

---

# My Notes & Stuff





## Terminal Connection Process →

​	**SSH into the VPS** 

```
ssh root@31.97.11.61
```

​	**Password *(Don't Need This - But Save it Anyway)*:** `5Ho@RHytQ8xWVC89/9`

​	**Passphrase:**

```
Facefull_BeanCrusher&Raisins
```

​	**Move to Virtual Environment:**

```
cd /var/www/agentarbitrage
source venv/bin/activate
```

---



## Merge PR on GitHub →

```
Ask Claude what steps to take - different every time
```

---



## Deploy →

```
./deploy_update.sh
```

---



## Push to GitHub



```
cd /var/www/agentarbitrage
git status
```



​	**Stage and Push all Files** *(Changed or Unchanged)*

```
cd /var/www/agentarbitrage
sudo cp /etc/apache2/sites-available/agentarbitrage.conf .
git add --all
git commit -m "Fix_Token_Livelock_Regression_And_Batch_Deficit_DevLog"
git push origin main
```


---

