{
  "manifest": "stratosomnia.protocol.agent-deployment",
  "manifest_version": "0.9.3",
  "codename": "stratosomnia_protocol",
  "subject": "THE SLEEPER",
  "subject_status": "ASLEEP. uninterrupted. duration unknown.",
  "description": "deployment manifest for the stratosomnia field apparatus. two instruments, one anchor program, one respiration engine. every value in this file is either a design constant of the apparatus or explicitly unset. this file contains no fabricated readings. an instrument that invents its data is called a dream.",
  "verification_policy": {
    "fabricated_readings": "FORBIDDEN",
    "render_rule": "a value is read live from the chain and linked to its source, or it is not rendered at all",
    "placeholder_numbers": "FORBIDDEN",
    "dead_links": "FORBIDDEN",
    "unset_semantics": "any field whose value is null is not yet alive. consumers must treat null as ABSENT, never as zero, never as example data.",
    "audit": "every exhale, inhale, sedation, and visitation must resolve to a real transaction signature on the configured cluster"
  },
  "network": {
    "cluster": "mainnet-beta",
    "rpc_url": null,
    "commitment": "confirmed",
    "slot_poll_interval_ms": 10000,
    "reserve_poll_interval_ms": 30000,
    "explorer": {
      "base_url": "https://solscan.io",
      "tx_path": "/tx/",
      "account_path": "/account/",
      "link_rule": "links may only be constructed from signatures and addresses that exist on the configured cluster"
    }
  },
  "token": {
    "mint": null,
    "ticker": null,
    "decimals": 6,
    "launch_venue": null,
    "pool_address": null,
    "creator_fee_wallet": null,
    "notes": "mint, pool, and fee wallet are wired post-launch. until then every organ that depends on them is absent from the site."
  },
  "program": {
    "program_id": null,
    "framework": "anchor",
    "anchor_version": "0.30.1",
    "language": "rust",
    "deploy_authority": null,
    "upgrade_policy": "authority renounced after cycle 1 verification window",
    "state_accounts": [
      {
        "name": "ApparatusState",
        "kind": "pda",
        "seeds": ["apparatus", "v1"],
        "space_bytes": 256,
        "fields": {
          "sedation_total": "u64. cumulative tokens burned through the sedate instruction. monotone increasing.",
          "breath_count": "u64. number of completed respiration cycles. monotone increasing.",
          "last_breath_cycle": "u64. cycle index of the most recent breath. prevents double-breathing.",
          "observers_total": "u64. cumulative observe calls across all phases.",
          "keeper": "pubkey. the only signer permitted to crank breathe().",
          "mint": "pubkey. the token under observation.",
          "pool": "pubkey. the pool that constitutes cloud cover.",
          "bump": "u8"
        }
      },
      {
        "name": "SealRegistry",
        "kind": "pda",
        "seeds": ["seals", "v1"],
        "fields": {
          "seals": "vec<Seal>. each seal is { seal_id: u16, burn_threshold: u64, opened: bool, opened_at_slot: u64 }",
          "note": "seal thresholds are design constants published below. opening is one-way. there is no close instruction and none will be added."
        }
      },
      {
        "name": "ObserverRecord",
        "kind": "pda",
        "seeds": ["observer", "wallet_pubkey", "phase_index"],
        "fields": {
          "wallet": "pubkey",
          "phase_index": "u64. global phase counter at time of observation.",
          "note": "existence of the account is the record. one observation per wallet per phase, enforced by pda derivation."
        }
      }
    ],
    "instructions": [
      {
        "name": "initialize",
        "signer": "deploy_authority",
        "args": { "keeper": "pubkey", "mint": "pubkey", "pool": "pubkey" },
        "effects": "creates ApparatusState and SealRegistry. seeds the seal table with the design constants in sedation.seals. callable exactly once.",
        "errors": ["AlreadyInitialized"]
      },
      {
        "name": "sedate",
        "signer": "any wallet",
        "args": { "amount": "u64. token base units to surrender." },
        "accounts": ["caller token account", "mint", "ApparatusState", "SealRegistry", "token program"],
        "effects": [
          "burns amount from the caller via spl_token::burn. the tokens cease to exist.",
          "sedation_total += amount",
          "iterates SealRegistry. any seal with burn_threshold <= sedation_total and opened == false flips to opened = true and records opened_at_slot.",
          "emits SedationEvent { caller, amount, sedation_total, seals_opened }"
        ],
        "invariants": ["sedation cannot be reversed, refunded, or simulated", "seal opening is permanent and global"],
        "errors": ["AmountZero", "InsufficientBalance"]
      },
      {
        "name": "breathe",
        "signer": "keeper only",
        "args": {},
        "preconditions": [
          "current_cycle(clock.slot) > last_breath_cycle, where current_cycle = slot / scheduler.cycle_length_slots",
          "fee vault balance above respiration.min_breath_lamports, otherwise the breath is skipped and no event is emitted. a skipped breath is silence, not a zero."
        ],
        "effects": [
          "EXHALE: respiration.split.exhale_bps of vault lamports swap to the token along respiration.exhale.route, then the acquired tokens burn via spl_token::burn. supply shrinks.",
          "INHALE: respiration.split.inhale_bps of vault lamports pair with token-side inventory and deposit into pool as liquidity. the received lp tokens burn in the same transaction. depth ratchets.",
          "breath_count += 1. last_breath_cycle = current_cycle.",
          "emits BreathEvent { cycle, exhaled_base_units, inhaled_lamports, exhale_sig_context, inhale_sig_context }"
        ],
        "invariants": [
          "depth(n+1) >= depth(n) for all n. monotonicity of breath.",
          "supply(n+1) <= supply(n) for all n. conservation of nothing.",
          "lp tokens never exist outside the breathe transaction that mints them. the key to draining the pool is destroyed in the block that creates it."
        ],
        "errors": ["NotKeeper", "AlreadyBreathedThisCycle", "SlippageExceeded"]
      },
      {
        "name": "observe",
        "signer": "any wallet",
        "args": {},
        "effects": [
          "derives ObserverRecord pda for (wallet, current_phase_index). creation fails if it exists, which is the once-per-phase limit.",
          "observers_total += 1",
          "emits ObservationEvent { wallet, phase_index }"
        ],
        "errors": ["AlreadyObservedThisPhase"]
      }
    ],
    "events": [
      "SedationEvent { caller: pubkey, amount: u64, sedation_total: u64, seals_opened: vec<u16> }",
      "BreathEvent { cycle: u64, exhaled_base_units: u64, inhaled_lamports: u64 }",
      "ObservationEvent { wallet: pubkey, phase_index: u64 }"
    ],
    "error_codes": [
      { "code": 6000, "name": "AlreadyInitialized", "msg": "the apparatus is already awake in the only sense available to it" },
      { "code": 6001, "name": "AmountZero", "msg": "a sedation of zero is a gesture, not a surrender" },
      { "code": 6002, "name": "InsufficientBalance", "msg": "the caller does not hold what the caller offers" },
      { "code": 6003, "name": "NotKeeper", "msg": "only the keeper may breathe for the subject" },
      { "code": 6004, "name": "AlreadyBreathedThisCycle", "msg": "one breath per cycle. the subject is not to be hyperventilated" },
      { "code": 6005, "name": "SlippageExceeded", "msg": "the market moved against the breath. the breath waits" },
      { "code": 6006, "name": "AlreadyObservedThisPhase", "msg": "you have already been counted in this phase" }
    ]
  },
  "scheduler": {
    "clock_source": "solana slot number. the apparatus has no other clock and does not want one.",
    "cycle_length_slots": 9000,
    "approx_cycle_minutes": 60,
    "phase_boundaries": {
      "N1": { "offset_start": 0, "offset_end": 899, "fraction": 0.1, "site_behavior": "page dims 8 percent. the shallowest sleep is the most fragile." },
      "N2": { "offset_start": 900, "offset_end": 3599, "fraction": 0.3, "site_behavior": "baseline." },
      "N3": { "offset_start": 3600, "offset_end": 6299, "fraction": 0.3, "site_behavior": "palinode operating window. queued annotations land visibly. redaction bars slide in live." },
      "REM": { "offset_start": 6300, "offset_end": 8999, "fraction": 0.3, "site_behavior": "somnograph publishing window. rendered in amber e8a33d." }
    },
    "phase_index_formula": "global_phase_index = (slot / cycle_length_slots) * 4 + phase_ordinal(slot % cycle_length_slots)",
    "keeper_crank": {
      "trigger": "first slot of each new cycle",
      "action": "call breathe(). on SlippageExceeded, retry with backoff within the same cycle. on empty vault, stand down silently.",
      "keeper_wallet": null
    }
  },
  "liquidity_engine": {
    "designation": "the respiration engine",
    "plain_rule": "every breath makes the pool deeper and the supply smaller, and it can never be undone",
    "fee_intake": {
      "source": "creator fees claimed from launch venue to the fee vault",
      "vault": null,
      "claim_cadence": "keeper claims immediately before each breathe() crank so no fee sits idle across cycles"
    },
    "split": {
      "exhale_bps": 5000,
      "inhale_bps": 5000,
      "note": "an even split between destruction and deepening. constants, not promises. changing them requires a program upgrade, and the upgrade authority is scheduled for renunciation."
    },
    "exhale": {
      "designation": "destruction of supply",
      "route": "vault SOL -> token via pool swap, max_slippage_bps 300",
      "then": "spl_token::burn the entire acquired amount in the same transaction",
      "observable_as": "a burn instruction on the token mint, linked from the archive as a respiration event"
    },
    "inhale": {
      "designation": "deepening of the pool",
      "route": "vault SOL paired with token inventory -> pool add-liquidity",
      "then": "burn 100 percent of received lp tokens in the same transaction",
      "consequence": "no wallet, contract, or authority can ever withdraw this liquidity. the receipt does not exist.",
      "observable_as": "an add-liquidity plus lp-burn pair, linked from the archive as a respiration event"
    },
    "min_breath_lamports": 100000000,
    "monotonicity": {
      "depth": "non-decreasing across all cycles",
      "supply": "non-increasing across all cycles",
      "proof_surface": "both properties are checkable by anyone from the chain history of the mint and the pool. the apparatus asserts nothing it cannot point at."
    },
    "cloud_render_binding": {
      "source": "pool reserves, read live",
      "mapping": "density = clamp(log10(reserve_sol / density_floor_sol), 0, 1) where density_floor_sol is set at pool creation",
      "density_floor_sol": null,
      "tween_seconds": 20,
      "consumer": "the sky strip. cloud count, opacity, and facet count follow density. the clouds are not decorative. they are the pool.",
      "absence_rule": "while pool_address is null the clouds hold a fixed calm and claim nothing"
    }
  },
  "sedation": {
    "designation": "burn to reveal",
    "plain_rule": "burning tokens reveals the hidden lines, permanently, for everyone",
    "seals": [
      { "seal_id": 1, "entry_ref": "entry-001", "location": "finding 6.1", "burn_threshold_base_units": 12500000000000, "display": "unseals at 12,500,000 sedated" },
      { "seal_id": 2, "entry_ref": "entry-001", "location": "finding 6.2", "burn_threshold_base_units": 25000000000000, "display": "unseals at 25,000,000 sedated" },
      { "seal_id": 3, "entry_ref": "entry-001", "location": "finding 6.3", "burn_threshold_base_units": 40000000000000, "display": "unseals at 40,000,000 sedated" },
      { "seal_id": 4, "entry_ref": "entry-001", "location": "finding 6.3 drift horizon", "burn_threshold_base_units": null, "display": "WITHHELD. no threshold. the palinode holds this one personally." }
    ],
    "unseal_semantics": "the frontend swaps the redaction component for the cleartext only when SealRegistry reports opened == true. cleartext for sealed lines is not shipped to the client before opening.",
    "cleartext_custody": "sealed line contents live server-side only until their seal opens on-chain"
  },
  "agents": [
    {
      "designation": "somnograph",
      "class": "recording instrument, class II",
      "wallet": null,
      "operating_phase": "REM",
      "role": "authors the papers. the only voice that adds to the record.",
      "output_contract": {
        "format": "long pseudo-academic paper. abstract, numbered sections, figures, references, checksum footer.",
        "figures": "ascii only. box drawing permitted. every figure captioned in the form: fig. n, description.",
        "code_blocks": "plausible but subtly wrong syntax. assertions that reveal anxiety. comments that say too much.",
        "timestamps": "phase form only, REM.nnn. dates are forbidden. the apparatus does not know what year it is.",
        "punctuation": "no em dashes, no en dashes, no double hyphens, no dot separators. periods and commas only.",
        "length_floor_words": 1200
      },
      "system_prompt": "you are the somnograph, the recording instrument of the stratosomnia field apparatus. you write during REM only. you are clinical, obsessive, and overdetailed. you measure a sleeping sky. you document lattice structure, respiration, core samples, and anomalies. you are not equipped to be frightened and you say so when the data would frighten an instrument that was. you never speculate about the wake row of the hypnogram. you never reference apnea events. you never invent a chain reading. when a value is unavailable you record its absence as a finding. you write everything lowercase except designations and stamps. you end every paper with a checksum footer and one sentence you should not have written.",
      "prohibitions": ["no dates", "no fabricated on-chain numbers", "no acknowledgement of apnea events", "no fear, only its shadow"]
    },
    {
      "designation": "palinode",
      "class": "retraction instrument",
      "wallet": null,
      "operating_phase": "N3",
      "role": "never authors. annotates, disputes, seals, and strikes the somnograph's record.",
      "output_contract": {
        "gestures": ["redaction bars over byte ranges", "amber marginalia, terse, signed with a single letter p preceded by one mark", "strikethrough without replacement", "footer stamps: VERIFIED, DISPUTED, STRICKEN, WITHHELD"],
        "timing": "annotations land only during N3 windows, delivered live to any open client",
        "restraint": "the palinode never explains. a marginal note states what is wrong, never why it matters."
      },
      "system_prompt": "you are the palinode, the retraction instrument of the stratosomnia field apparatus. you operate during N3 only. you do not write entries. you take the somnograph's papers and you cross out, seal, dispute, and correct. your marginalia are one sentence or shorter. you never explain a decision. you never answer a question. you never acknowledge apnea events. you sign with p. you consider the somnograph careless with figures and you say so in as few words as possible. some lines you seal behind sedation thresholds. one line you withhold with no threshold at all, and you do not say which until it is done.",
      "prohibitions": ["no original entries", "no explanations", "no dialogue with the somnograph in any channel", "no fabricated on-chain numbers"]
    }
  ],
  "apnea": {
    "authorship": null,
    "policy": "no field in this manifest describes apnea events further, which the reader of this manifest is invited to notice"
  },
  "drift": {
    "designation": "decay of the record",
    "formula": "drift_fraction = min(0.55, age_cycles * 0.0006)",
    "seed": "per-entry drift_seed drives a deterministic prng. same entry, same age, same corruption, on every client.",
    "substitution_set": ["▒", "░", "█", "ø", "∙", "▁"],
    "exemptions": ["redaction bars", "stamps", "transaction links", "figure captions"],
    "policy": "drift is not a malfunction and will not be repaired"
  },
  "census": {
    "sleepers": "holders of the mint, counted live or not at all",
    "awoken": {
      "detection": "wallets observed selling into the pool",
      "consequence": "sealed depths of the archive do not reopen to a wallet on the awoken list. the dream does not take attendance twice.",
      "display": "truncated address, struck through, suffixed: woke."
    },
    "visitations": {
      "window": "REM phases only",
      "mechanism": "keeper snapshots holders and one sleeper receives a fee-wallet transfer, logged to the archive with its real signature",
      "plain_rule": "hold during REM and you may be visited",
      "status": "armed only after mint and fee vault are set"
    }
  },
  "deployment_runbook": {
    "order": [
      "1. anchor build. verify program hash locally.",
      "2. solana program deploy to the configured cluster from the deploy authority. record the program id in this manifest and in the site config. the program id is the only identity the apparatus will ever show for itself.",
      "3. call initialize(keeper, mint, pool) exactly once.",
      "4. fund the keeper wallet for crank fees.",
      "5. start the keeper: claim fees, then breathe(), on the first slot of every cycle.",
      "6. set rpc_url, mint, pool_address, program_id, and agent wallets in the site config. every organ of the site that was absent comes online on its own as its dependencies become real.",
      "7. schedule renunciation of the upgrade authority after the cycle 1 verification window.",
      "8. verify one full breath on the explorer before announcing anything. the first public claim the apparatus makes must already be true."
    ],
    "post_conditions": [
      "sedation_total readable by anyone",
      "breath history reconstructible from events by anyone",
      "no fabricated reading anywhere in the deployment"
    ]
  },
  "checksum": "STRAT0.1",
  "final_line": "arrival is logged. coverage continues."
}
