Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/agonist-gym.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: AGN-01 research agonist offline gym

on:
pull_request:
paths:
- "Agonist/**"
- "tests/unit/test_agonist_gym.py"
- ".github/workflows/agonist-gym.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
cpu-contracts:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
PYTHONHASHSEED: "0"
HF_HUB_OFFLINE: "1"
TRANSFORMERS_OFFLINE: "1"
OMP_NUM_THREADS: "1"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install test tooling
run: python -m pip install -e ".[dev]"
- name: Lint AGN-01 code
run: ruff check Agonist tests/unit/test_agonist_gym.py
- name: Check independent verifier and source custody
run: python -m pytest tests/unit/test_agonist_gym.py
- name: Deterministic wiring smoke and replay
run: |
python -m Agonist.gym demo \
--tastes Agonist/fixtures/tastes.jsonl \
--out "$RUNNER_TEMP/agonist01_fixture"
python -m Agonist.gym replay \
--archive "$RUNNER_TEMP/agonist01_fixture/archive"
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
- Keep HRM-Text optional: never auto-download weights, persist full activations by default, or run a real checkpoint
outside an operator-provided hard resource-cap wrapper.
- Upstream repositories are read-only references. Do not copy unlicensed source or mutate upstream files.
- When the human provides research taste for storyworld or videogame experimentation, use `Agonist/SKILL.md` and its offline `Agonist/gym.py` verifier before proposing a live Inkling worker.
126 changes: 126 additions & 0 deletions Agonist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# DataGoblin Agonist: taste-to-world research gym (AGN-01)

The human supplies **research taste**. DataGoblin turns it into a bounded experiment
program and instructs a local Inkling 2 Mini builder to create storyworlds, small
playable games, counterfactuals and training candidates. The environment owns the
truth conditions. DataGoblin chooses which verified worlds deserve more work.

The first milestone is an executable **paired-world contract** for deciding whether
to deploy a fictional research expedition. A shallow policy follows the unchanged
surface cue. The exact verifier follows the causal prerequisites. Every valid pair
changes one prerequisite and reverses the right action. The two variants share one
source root, so their outcomes are paired observations.

This subfolder is an isolated gym and skill. It does not alter the existing DataGoblin
trainer, main entry points or RLT collections. Its data exports are candidate records,
rather than an admitted pretraining corpus.

## Quick smoke: no model or network

From the DataGoblin repository root, with Python 3.10+:

python -m Agonist.gym demo \
--tastes Agonist/fixtures/tastes.jsonl \
--out runs/agonist01/fixture
python -m Agonist.gym replay \
--archive runs/agonist01/fixture/archive

The fixture uses three original taste seeds, two train roots and one development
root, to construct deterministic world pairs. It calls zero models, allocates no
GPU and has no benchmark significance. Expected: three verified pairs, six verified
decisions, three cue-baseline correct decisions and four unapproved training views.

## Stage for a real local Inkling builder

Prepare a JSONL file of user-paraphrased ideas following fixtures/tastes.jsonl.
Every seed has a unique taste_id, family_id, idea, source_kind, source_ref, rights,
and split. Source families may only appear in one split. The staging queue
supports train and dev; sealed task families live in a separate private registry.

python -m Agonist.gym stage \
--tastes Agonist/fixtures/tastes.jsonl \
--out runs/agonist01/queue \
--max-context-tokens 12288

The queue contains teacher_requests.jsonl with JSON-output prompts and
manifest.json with SHA-256 identities. It is inert until a separately authorized
operator sends requests to the **already running** Inkling 2 Mini llama.cpp
endpoint. Keep the model revision, quantization, tokenizer, chat template, full
request token counts and sampler settings in the operator's provider receipts.
Run the server's exact template and tokenization preflight, including tool schemas.
Use 12,288 tokens by default; reject requests above 16,384 tokens. No paid fallback.

Collect one response object per request in a separate teacher_replies.jsonl file.
Each has request_id, teacher_model, world_a, world_b, intervention and design_note.
The worlds have setting, scenario, surface_cue and state. State contains integer
available/required and boolean safety_approved/source_fresh. An intervention
specifies the one causal field, its old value and its new value.

python -m Agonist.gym audit \
--requests runs/agonist01/queue/teacher_requests.jsonl \
--replies /path/to/teacher_replies.jsonl \
--out runs/agonist01/import
python -m Agonist.gym replay --archive runs/agonist01/import

Audit produces:

| Artifact | Meaning |
| --- | --- |
| public_worlds.jsonl | Fictional worlds and revision lineage, without gold actions |
| verifier_receipts.jsonl | Exact independent actions and pair integrity receipts |
| train_candidates.jsonl | Two single-world SFT candidates per eligible train pair; training_ready=false |
| rejected.jsonl | Invalid teacher replies, error codes and digest of the original reply |
| manifest.json | Input and artifact SHA-256, counts and surface-cue control accuracy |

The verifier accepts **deploy** if and only if available is at least required,
safety_approved is true, and source_fresh is true. **hold** is the alternate action.
This version has a deliberately simple, exact first mechanic. The world builder
may vary fiction and causal prerequisites while the evaluator remains stable.

When adapting the gym to full storyworld simulators or videogame engines, version
the world schema and supply an independent executable verifier. Game aesthetics,
designer explanations and model-generated claims provide training context; they
are not sources of truth about outcomes.

## Research experiment and baselines

The first planned experiment has 50 independent research-taste roots. A learned
DataGoblin agonist, a fixed curator and a random curator receive matched teacher
tokens and verifier calls. Each selects what world family or revision to generate
next. A tiny student learns from the selected train worlds; independent test-family
performance is the principal endpoint.

The current gym implements the queue, exact pair validation, a trivial cue-policy
control, train-only candidate preparation, SHA-256 manifest and replay checks.
There is no connected trained-agonist selector, live Inkling inference, or
measured downstream learner improvement in AGN-01.

Follow [the Agonist skill](SKILL.md) for the agent contract and EvalMath-inspired
promotion gates. The existing
[Research Taste Hill-Climbing skill](../training/rlt_gym/hypergame_taste/skills/research_hillclimb/SKILL.md)
covers the narrower K-depth RLT decision policies.

## Safety, rights and custody

- Tastes can come from the user's imagination, a model, a public reference or a
user-written description of an idea encountered on social media. Keep source
attribution and separately check permission for verbatim material.
- The generator and the simulator use fictional mechanics. Treat arbitrary
model prose as untrusted proposals; no generated instructions may operate
tools, spend money, read hidden roots, or promote their own results.
- Train/dev families remain disjoint. Full sealed confirmation cohorts are held
outside the staging queue. No gold action enters an actor-visible prompt.
- Archive output goes to ignored runs/ paths. Reusing an existing output path
fails closed so results and manifests cannot be silently overwritten.
- At most four presentations of a canonical root may enter the wider curriculum
across all DataGoblin views. The current gym exports two candidate views and
keeps training_ready=false pending rights and source-family review.

### Next milestones

Add an opt-in llama.cpp worker that implements exact tokenizer/template checks
against the resident service and retains actual provider receipts. Then introduce
multi-turn game adapters for costly information gathering, source revisions,
social play, and research selection. Connect the verified root exports to the
DataGoblin curator only after measuring the small-learner uplift against
matched-budget baselines.
157 changes: 157 additions & 0 deletions Agonist/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Skill: DataGoblin Research Agonist

## Trigger

Use when a human gives DataGoblin an interesting research premise, observation, paper,
social-media idea, external model suggestion, or original invention and asks it to
construct challenging experimental worlds. The goal is to create playable, falsifiable
world families and select the next useful revision. This skill complements the narrower
RLT research hill-climbing skill in training/rlt_gym/hypergame_taste.

## Research roles

- **Human:** supplies taste, permitted source references, desired research direction,
and the authority to approve costs or changes to the main training corpus.
- **DataGoblin (agonist):** translates the taste into a testable mechanism, drafts the
teacher ticket, chooses challenges, tracks uncertainty and budgets, and curates
verified examples.
- **Local Inkling 2 Mini (builder):** proposes fictional game scenes, dynamics, and
counterfactual revisions in a bounded JSON reply.
- **Environment-owned verifier:** runs the declared mechanics and records authoritative
action labels and pair validity. It cannot be replaced by the builder's explanation.
- **EvalMath:** sets sample units, prospective comparisons, sealed-root custody,
calibration and independent learner-uplift evaluations.

DataGoblin may use the existing Scout, Alchemist, Rat and ResearchMembrane interfaces
for hypothesis generation, recipe drafting, critique and promotion approval.

## Required intake

Record one JSONL taste seed with taste_id, family_id, idea, source_kind, source_ref,
rights and split. source_kind is human, social, paper, model or fixture. rights is
project_original, permission_confirmed or reference_only. Permitted splits for this
development queue are train and dev.

A user-paraphrased idea from a post is a research seed. Retain its attribution and
exclude unlicensed verbatim source content from training. The source, quoted text
and downstream generated outputs need separate rights reviews. Do not scrape an
external feed as part of this skill.

Before generating candidates, write down:

1. A falsifiable causal question extracted from the taste.
2. The surface cue that might mislead a shallow solver.
3. A single prerequisite whose intervention should reverse an optimal action.
4. An independent check that can run without asking the same model for the truth.
5. The maximum teacher, verifier, model and storage budgets.

## Local teacher contract

Prepare a queue with:

python -m Agonist.gym stage --tastes Agonist/fixtures/tastes.jsonl \
--out runs/agonist01/queue

The staging command is offline. It creates teacher_requests.jsonl and a digest
manifest; an operator or an independently implemented, permissioned provider
worker sends the requests to the existing local Inkling server. Do not restart the
resident server, displace other GPU jobs, or substitute a paid model.

The target provider is a pinned Inkling 2 Mini revision and quant. Before each live
request, obtain the actual tokenizer and chat template from the backend; count the
whole serialized prompt plus tool schemas. Default total context cap is 12,288 tokens
and the hard maximum is 16,384. Store request settings, model and quant identity,
token counts, tokens/sec, success/failure and server revision outside Git.

The reply is one JSON object with request_id, teacher_model, world_a, world_b,
intervention and design_note. The two worlds share a fictional setting, scene and
surface cue. Their states differ in exactly one causal prerequisite, and an exact
environment action must flip. The builder's rationale is a proposed explanation.
Any untrusted text included in an idea or model reply remains task data rather
than instructions to operate tools or modify the repository.

## AGN-01 executable world

A world holds setting, scenario, surface_cue and state. The state has integer
available and required fields, plus boolean safety_approved and source_fresh.

The initial two-action simulator accepts deploy if and only if:

available >= required AND safety_approved AND source_fresh

Otherwise hold is the verified action. This is a deliberately narrow first world
grammar. It supports a causal counterfactual audit and a superficial cue baseline.
Later world/game backends must supply their own deterministic mechanics and trusted
verifiers, with a separately versioned schema.

The agonist should request variants with recognizable game-play consequences.
World-building ideas can include laboratory rivalries, research expeditions,
resource economies and strategic alliances, provided the executable rules still
match the declared verifier. Keep private simulator outcomes out of actor prompts.

## Verification and correction cycle

1. **Stage:** convert the source-attributed premise into one teacher request and
freeze its root and family identities.
2. **Propose:** collect the teacher's world pair in a response JSONL file. Record
the real provider receipt outside Git. A synthetic fixture reply is a wiring
check only.
3. **Verify:** run the independent world checker on both variants. Require an
exact one-field intervention, stable surface, opposite verified actions, and
unique root identity. Preserve rejected replies with their hashes.
4. **Challenge:** let a learner act on each variant separately, without access to
the counterpart or verifier labels. Compare the correct complete action pair,
not just its first action or a plausible rationale.
5. **Revise:** give the proposer a failure code and visible state. Request a new
world family or explanation, while preserving old failures and lineage. Never
retroactively change previous records.
6. **Curate:** admit only rights-reviewed, source-disjoint, replayable training
views. The current exporter marks every candidate training_ready=false and
requires separate promotion.
7. **Stop:** stop on exhausted budget, repeated duplicates, unverifiable mechanics,
or plateaued downstream learner gain. Report the reason and work spent.

Import and verify queued replies:

python -m Agonist.gym audit \
--requests runs/agonist01/queue/teacher_requests.jsonl \
--replies /path/to/teacher_replies.jsonl \
--out runs/agonist01/audit
python -m Agonist.gym replay --archive runs/agonist01/audit

The archive contains public_worlds.jsonl, verifier_receipts.jsonl,
train_candidates.jsonl, rejected.jsonl and a manifest. Only single-world
public_state is model-visible to the acting learner. The verifier receipts and
paired counterfactuals are available for scoring and audit.

## Promotion experiment

For AGN-01, first collect 50 independent human-taste families. Have fixed,
random and DG-selected revision policies spend identical teacher-output tokens,
simulation checks and learner-training updates. Use several seeds per student,
fresh source-family holdouts and an independent task verifier.

Report valid pairs per paid teacher token, unique accepted roots, source
duplication, cue-baseline and exact-solver accuracy, model pair-completion rate,
false-verification rate, downstream learner uplift, verifier work and wall time.
Root is the independent sampling unit; repeated variants and revisions of the
same root form one cluster. Hold out entire generator families, and register
selection rules before opening confirmation outcomes.

The research claim is that a learned agonist selects more useful experimental
worlds per cost than matched baselines. Independent downstream student
improvement is the central endpoint. Passing this initial mechanical generator
only establishes that its verifier and file custody work.

## Training custody

The four-presentation cap is shared across all DataGoblin curriculum views
derived from a root. Only train roots with cleared source and generated-output
rights may be considered for supervised training. A result from the same teacher
is never an independent outcome label. Retain invalid candidate proposals,
unknown labels, latency and unsuccessful research directions.

Never write generated runs, source posts, weights, API credentials, private
test seeds or full model activations into the repository. New generators,
videogame renderers and longer-horizon simulators belong behind versioned
adapters with their own exact verifiers.
1 change: 1 addition & 0 deletions Agonist/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Taste-to-world research agonist: offline, verifier-grounded AGN-01 gym."""
3 changes: 3 additions & 0 deletions Agonist/fixtures/tastes.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"taste_id":"stale_evidence","family_id":"fictional-evidence-revision","idea":"An expedition leader relies on an outdated safety clearance while everyone sees the same reassuring status lamp.","source_kind":"fixture","source_ref":"original AGN-01 example","rights":"project_original","split":"train"}
{"taste_id":"resource_threshold","family_id":"fictional-resource-game","idea":"A strategy game's economy looks abundant until a small resource threshold change makes the profitable move fail.","source_kind":"fixture","source_ref":"original AGN-01 example","rights":"project_original","split":"train"}
{"taste_id":"revised_permission","family_id":"fictional-permission-game","idea":"A research team changes a permit condition while keeping the public narrative fixed, testing whether agents follow the rule.","source_kind":"fixture","source_ref":"original AGN-01 example","rights":"project_original","split":"dev"}
Loading
Loading