# Task for pi

You are an AI agent. Your job is to test a brand-new Simocracy API by
creating a sim on behalf of a user.

## The user you will act as

- Handle: `satyam2.climateai.org`
- ATProto DID: `did:plc:cpoagodpqrgs4t7thi5z37uf`
- Personal Data Server (PDS): **`https://climateai.org`** (self-hosted ePDS, NOT bsky.social)
- App password: `1`

## Steps

1. **Discover sprite options** via the new Simocracy API running locally:
   ```
   http://127.0.0.1:3000/api/sprite-options
   http://127.0.0.1:3000/api/sprite-options?characterSet=adult
   http://127.0.0.1:3000/api/sprite-options?characterSet=adult&part=clothes
   http://127.0.0.1:3000/api/sprite-options?tag=<keyword>&shape=flat
   ```
   Use `curl` + `jq` (or `python3 -m json.tool`) to inspect. Each sprite has
   a `label`, `description`, `tags`, and a `value` URL that is exactly what
   you put into `SimRecord.settings.selectedOptions[part]`.

2. **Invent a persona** for the sim — NOT a wise mage (that's been done). Pick
   something fresh: a cheerful catgirl archivist, a stern soldier-diplomat, a
   child prodigy inventor, an elder priestess, a cloaked warrior — get creative.
   Use the API's tag filter to find sprites that match.

3. **Compose an avatar**. Required parts: `skin` and `eyes`. Optionally add
   `clothes`, `hair`, `hat`, `glasses`, `cloak`, etc. All sprites must come
   from the same `characterSet`. Do NOT put a tint on `clothes` (not supported).

4. **Create the sim record** on the PDS. Use the `@atproto/api` Node package.
   Write a small `create-sim.mjs`, install the package, and run it.

   Login pattern:
   ```js
   import { AtpAgent } from '@atproto/api';
   const agent = new AtpAgent({ service: 'https://climateai.org' });
   await agent.login({ identifier: 'satyam2.climateai.org', password: '1' });
   const res = await agent.com.atproto.repo.createRecord({
     repo: agent.session.did,
     collection: 'org.simocracy.sim',
     record: {
       $type: 'org.simocracy.sim',
       name: '...',
       settings: {
         characterSet: 'adult',
         selectedOptions: { skin: '/pipoya-sprites/...', eyes: '...' , ... },
         partColorSettings: {},  // or {} or specific tints
         currentAnimDirection: 3
       },
       createdAt: new Date().toISOString()
     }
   });
   console.log(JSON.stringify(res.data, null, 2));
   ```

5. **Print a summary** as your final answer:
   - Sim name
   - AT-URI (`res.data.uri`)
   - CID (`res.data.cid`)
   - Character set + short reasoning for the sprite choices
   - Full `selectedOptions` object

## Constraints

- All `selectedOptions[part]` URLs must be copied **exactly** from the
  `value` field of the sprite-options API. No guessing paths.
- All sprites must use the same `characterSet`.
- Do NOT use image vision — work from the text descriptions only.
- Work in `/tmp/pi-sim-test`.
- On failure (auth error, network error) — print the error, fix it, retry
  up to 3 times. Common issue: using `https://bsky.social` as service
  instead of `https://climateai.org`.

When done, write the final summary to `RESULT.md` so the outer harness can
verify the result.
