---
name: finance
description: Portfolio, ledger and payout finance operations for cluster. Use when the user wants their portfolio value and holdings, the $CLST payout basket composition and weights, distribution cycles and history (who got paid, when, how much), treasury status, API key management with usage metering (requests/tokens/USD), or double-entry style bookkeeping of agent activity. Covers the ledger agent (Ledger/FIN), payments agent (Remit/RMT), risk agent (Margin/MRG), and treasury agent (Vault/VLT) workflows.
allowed-tools: Read, Write, Edit, Bash(curl:*)
license: MIT
metadata:
  author: clusteragent
  version: "1.0.0"
title: finance
canonical_url: https://skilld.dev/gh/clusteragent/cluster/finance
last_updated: 2026-09-21T00:45:59.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install clusteragent/cluster/finance`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/finance`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/clusteragent/cluster/finance) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/finance`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/finance --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/finance --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Cluster Finance

Portfolio truth, payout records, and metering. Every number here is either read
on-chain or from the public keeper-bot feed — never fabricated. Pre-launch payout
data returns honest zeros by design.

## Portfolio

```bash
# Portfolio + history (wallet-scoped, auth required)
curl "https://clusteragent.dev/api/portfolio?wallet=0xUSER&session_token=…"
curl "https://clusteragent.dev/api/portfolio/history?wallet=0xUSER&session_token=…"
```

- The real "position" is the wallet's **$CLST token balance**, read on-chain
  (`AGENTINDEX_CLST_TOKEN_ADDRESS` / `AGENTINDEX_CLST_TOKEN_ADDRESS` env on the server)
- Before $CLST deploys, portfolio is honest zeros with a note — no invented rows
- On-chain balances for any address, no auth needed:

```bash
curl "https://clusteragent.dev/api/trade/wallet/0xADDRESS"
# → native ETH + every held token, raw values from Multicall3.aggregate
```

## The Payout Basket

19 curated instruments, weights sum to 100. The keeper bot buys this basket from
accumulated fees at live market prices.

```bash
curl "https://clusteragent.dev/api/index/payout-basket"
```

```json
{ "count": 19, "weight_sum": 100.0, "universe_count": 193,
  "note": "Holders are paid from this curated basket. The full 193-instrument
           universe is tradeable; the basket is the payout vehicle." }
```

19 payout names vs **193 tradeable instruments** — different things, keep them
distinct when answering users.

## Distributions — the public record

```bash
curl "https://clusteragent.dev/api/distributions"
```

```json
{ "live": true, "mode": "dry",
  "totals": { "cycles": 0, "distributed_usd": 0.0, "recipients": 0 },
  "treasury": { "address": "0xcdfc…8827", "eth": 0.004169 },
  "cycles": [], "recent_buys": [] }
```

- `mode: "dry"` = keeper bot running without settling; `live` = real cycles
- Recipient lists are **never public** — the feed exposes cycles, per-cycle
  aggregates and basket buys. No payroll, no holder ranking.
- `recent_buys` = every keeper basket purchase with tx
- `treasury.eth` = live vault balance, refreshed ~60s

## API Keys & Metering

```bash
# create (raw key shown ONCE — SHA-256 stored)
curl -X POST "https://clusteragent.dev/api/keys" -H "Content-Type: application/json" \
  -d '{"wallet":"0xUSER","session_token":"…","name":"prod"}'

# list
curl "https://clusteragent.dev/api/keys?wallet=0xUSER&session_token=…"

# usage: requests, tokens, USD per key
curl "https://clusteragent.dev/api/keys/usage?wallet=0xUSER&session_token=…"
```

Limits: 20 active keys per wallet. Keys are wallet-bound — a key can never touch
another wallet's data.

## Credit Accounting

Every wallet gets **$5 inference credit**. Chat requests reserve worst-case cost
up front, then true-up from actual token usage — two concurrent requests cannot
double-spend the remainder. Rate limit: 30 chat requests/minute.

```bash
curl "https://clusteragent.dev/api/chat/credits?wallet=0xUSER"
# → { "granted_usd": 5.0, "used_usd": 0.0, "remaining_usd": 5.0 }
```

## The Finance Agents

| Agent | Role | Workflow |
|---|---|---|
| **Ledger** (FIN) | Bookkeeping & reconciliation | Log every agent interaction to the wallet history; settle in $CLST post-launch |
| **Remit** (RMT) | Payments & invoicing | Record tip intents between wallets (`POST /api/social/tip`, self-tip blocked, 0x-address validated) |
| **Margin** (MRG) | Risk & margin | Track exposure across holdings (`/api/trade/wallet`), flag concentration, keep books balanced |
| **Vault** (VLT) | Treasury | Monitor `distributions.treasury.eth`, report vault accumulation, compound idle balances post-launch |

## Maybe Finance (self-hosted personal finance UI)

For a full double-entry personal finance UI on top of cluster data, self-host
[Maybe](https://github.com/maybe-finance/maybe) (AGPLv3, unmaintained upstream —
fork under the license terms: keep the LICENSE, state the fork is not affiliated
with Maybe Finance Inc., do not use the "Maybe" trademark or logo):

```bash
git clone https://github.com/maybe-finance/maybe
cd maybe
# Docker self-host
docker compose up -d
```

Maybe's account/transaction model maps well: cluster wallet = Maybe "account",
keeper-bot distributions = "transactions", the payout basket = an investment
"portfolio". Pull cluster data into it via the REST API.

> Trademark note: rename the deployment (e.g. "Cluster Ledger") in any user-facing
> surface.
