> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/phases/phase_30/session_04_economy_and_ledger.md).

# Session 04: Economy And Ledger

**Session ID**: `phase30-session04-economy-and-ledger` **Status**: Not Started **Estimated Tasks**: \~12-25 **Estimated Duration**: 2-4 hours

***

## Objective

Implement the browser-safe AI OS economy projection, manual claim flow, and minimal ledger provenance.

***

## Scope

### In Scope (MVP)

* Build `deriveAiRogueEconomy(liveData)` as a pure transform over browser-safe `LiveData` branches.
* Apply the locked weighted blend: completed work (40%), skill diversity (25%), tool-class diversity (20%), capped token/spend signal (10%), and readiness/streak bonuses (5%).
* Treat unavailable pricing, unknown tokens, example data, and missing provider telemetry as absent contributions rather than penalties.
* Add daily earning caps, provenance labels, and idempotent redemption keys by date, provider, and activity run ID where available.
* Render the Ledger view with claimable `Insight Shards`, a manual claim action, and a compact "why did I earn this?" breakdown.

### Out of Scope

* IndexedDB persistence plumbing (Session 05 wires durable storage).
* Spending currency on upgrades (Session 07).

***

## Prerequisites

* [ ] Session 02 shell in place.

***

## Deliverables

1. Economy schema and tested transform modules.
2. Manual claim UI and ledger entries with bounded, explainable rewards.
3. Fixture coverage for missing data, unknown pricing, example data, repeated redemption attempts, and source-weight behavior.

***

## Locked Visual Assets (`visual-assets.md`)

`docs/extensions/ai-rogue/visual-assets.md` locks the currency presentation this session's claim/Ledger UI should match:

* `Insight Shards` have **two visual forms**: an in-run cyan pickup (`pickup_insight_shard_*` in the gameplay atlas) and the banked `Insight Cache` reward (`icon_insight_cache` in the UI atlas). In-run pickups are feedback; the post-run/claim screen banks the authoritative reward -- reinforcing that raw pickups are not the dominant source.
* Committed UI-atlas icons available for the Ledger/claim surface: `icon_shard_hud`, `icon_insight_cache`, `icon_claim_reward`, `icon_cache_chest`.

## Success Criteria

* [ ] Claims are deterministic for the same input snapshot and cannot double-credit after refresh.
* [ ] Ledger provenance explains each claim without exposing prompts, transcripts, commands, private paths, credentials, or logs.
* [ ] Economy tests cover missing or partial telemetry without failing the whole claim.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/phases/phase_30/session_04_economy_and_ledger.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
