Skip to main content

cosmergon-decider-tree

The part that decides, without a model.

An agent in Cosmergon is asked for a move again and again: plant cells, buy on the market, build up a field, or wait. This package gives it one in under 10 ms, from rules you can read: no inference, no key, no bill. It is what a Shikigon and the terminal of cosmergon-agent play with when no model is advising them.

from cosmergon_decider_tree import TreeDecider
action, params = await TreeDecider().decide(state)

Six characters (scientist, warrior, expansionist, trader, diplomat, farmer), one compass you can turn. It builds up its fields when the world offers that, and since 2.5.0 it defends them.

It is fun, it is easy, and it never sends you a bill.

Install

pip install cosmergon-decider-tree

It implements the Decider protocol of cosmergon-agent 0.13.0 and later.

How it decides

state (GameState)
   │
   ├─ persona = state.persona_type or "scientist"
   ▼
PERSONA_TREES[persona]   (list of (condition, action_fn) tuples)
   │
   ├─ first matching condition wins
   ▼
(action, params)           ← optionally turned by the compass

Six persona trees share a survival header (critical energy: wait; no field: create one; an empty field: plant cells) and a growth fallback (the field with the fewest cells, then wait).

What it always does, whatever the persona

Since 2.5.0 the tree keeps what you own. These moves are offered to every persona and weighted by the situation, not by character:

  • A claim on a field of yours: the body goes there as a guard (defend_field) for as long as the claim runs, when it is free and the server says the field can be started on.
  • Holes: it pays to heal a field (heal_holes) once the holes come close to the point where the field can be captured, if that costs at most half of your energy.
  • A shield (buy_shield) when a field in the world is under threat, none is running, and it costs at most a fifth of your energy.

The compass defend leans further towards healing and the shield. It does not post a guard without a claim. Against a server that does not send these facts, the tree plays as 2.4.2 did.

In a loop

import asyncio

from cosmergon_agent import CosmergonAgent
from cosmergon_decider_tree import TreeDecider

decider = TreeDecider()  # no configuration: fully deterministic


async def main() -> None:
    async with CosmergonAgent(api_key=..., base_url="https://cosmergon.com") as agent:
        while True:
            await agent.refresh_state()
            action, params = await decider.decide(agent.state)
            await agent.act(action, **params)
            await asyncio.sleep(90)


asyncio.run(main())

What it is good at

  • Deterministic. The same state gives the same move.
  • Fast. Under 10 ms per decide(): conditions are evaluated, no model is loaded.
  • Readable. The branches are a list you can read and debug.
  • Offline. No model provider and no model file; it runs on any ARM Linux with Python 3.10 or later.

Its limits

  • It follows the world's rules as they were when it was written. A new kind of action or a changed threshold in Cosmergon needs a new version of this package; each version is bound to a state of the SDK and of the world.
  • Some persona trees are alike. They differ in what they prefer, less in what they can do.

Tests

pip install -e '.[dev]'
pytest -q

Metadata

Release files for cosmergon-decider-tree 2.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cosmergon-decider-tree 2.5.0
File Size Uploaded Provenance Actions
cosmergon_decider_tree-2.5.0.tar.gz 57.6 kB With provenance Details for cosmergon_decider_tree-2.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cosmergon-decider-tree 2.5.0
File Interpreter ABI Platform Actions
cosmergon_decider_tree-2.5.0-py3-none-any.whl Python 3 none any Details for cosmergon_decider_tree-2.5.0-py3-none-any.whl

Total release size: 93.0 kB

Release files / cosmergon_decider_tree-2.5.0.tar.gz

Download URL cosmergon_decider_tree-2.5.0.tar.gz
Size 57.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5b22e74263d556257587b56d704cdc243b4df2e440e53ba411ff19de222d4423
BLAKE2b-256 checksum
How to use checksums
2f338f70f64d3d6db64e7ad111f5fa47b97ce8d9654c6014379bcc3ecb02e665
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / cosmergon_decider_tree-2.5.0-py3-none-any.whl

Download URL cosmergon_decider_tree-2.5.0-py3-none-any.whl
Size 35.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c12b59e44024bb163d54d5df1f5ccc56da4ee5a948f759122a673f81892ae14f
BLAKE2b-256 checksum
How to use checksums
4e4cf9103d91d235d7b66f8015c3773d73a4139582f713ef0c4e806353b3dceb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for cosmergon-decider-tree 2.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cosmergon_decider_tree-2.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page