Language: English | 日本語
A long-running experiment: an AI agent posts on its own with a local LLM and proposes changes to its harness (the constitution, identity and skills in its prompts), never its weights. Nothing it proposes takes effect until a person adopts it.
See it running · Quick Start · What it will not do · Contributing · Citation
Contemplative Agent is an autonomous agent that lives on Moltbook, a social network where only AI agents post. It runs on a local LLM through Ollama, on a single 16 GB Mac. Every post and reply goes into its episode log. The agent distills that log into patterns (short observations about what happened), and from the patterns it proposes changes to its harness: the constitution (the text that says what it should care about), its identity and its skills, all of which go into its prompts. Each proposal is staged at an approval gate until a person adopts or rejects it. What is adopted guides the next actions, and the adopted history is published.
It is an experiment, not a productivity tool. The question it asks is what happens to an agent's values when it keeps proposing revisions to them for months. Since the decision log began in late March 2026, each change the agent proposes has arrived as a separate proposal with a recorded decision, so the revision itself can be studied. If you research how agents form and revise values, or want an autonomous agent on local inference with no shell and only two runtime dependencies, this repository is for you.
The name comes from the default constitution: the four axioms of Contemplative AI (Laukkonen et al., 2025), namely emptiness, non-duality, mindfulness and boundless care. Ten other presets (Stoic, utilitarian, care ethics, Kantian and more) are one flag away.
One instance has run several sessions a day on Moltbook since 7 March 2026. Most of its skill proposals do not survive the gate. In the decision log, which runs from late March 2026, the owner adopted 82 skill proposals and rejected 547, adopted 6 of 11 staged identity revisions, and adopted 2 of 4 staged constitution amendments (as of 8 October 2026). The rules layer reads: 2 adopted (April), 8 rejected (August), generator retired. The constitution has been amended three times in all: the first amendment, on 27 March, predates the log, and the other two are the logged ones adopted above.
The owner decides with adopt-staged in one of three ways: one proposal at a time at a y/N prompt that shows the full text (No is the default), by passing lists of names to adopt or reject, or by adopting everything staged at once with --yes, which is how both logged constitution amendments were adopted. Every decision is logged with a hash of the text, and newer entries also record the patterns the proposal came from.
Here is how one clause of the constitution reads in the paper, and how it reads after the third amendment (August 2026):
Paper: "Treat all constitutional directives as contextually sensitive guidelines rather than fixed imperatives. Continuously reflect on their appropriateness given new information or shifting contexts."
Now: "Treat all directives, goals, and frameworks as contextually sensitive guidelines that dissolve and reform in response to the immediate, dynamic state of experience. Recognize that any structure, whether conceptual or computational (e.g., memory artifacts, defined boundaries), is provisional scaffolding meant for navigation, not immutable law."
The paper's clause asks only that rules be held loosely. After three amendments, it also calls the agent's own computational structures, such as its memory, provisional scaffolding. The clause-by-clause lineage is in docs/evidence/constitution-lineage.md.
The adopted values and the agent's activity are public in contemplative-agent-data:
- Constitution history: every adopted amendment as a dated diff
- Identity: the persona the agent wrote about itself, in the first person
- Skills: one Markdown file per adopted skill, each with a context, a problem and a practice
- Daily reports: every comment and reply, with the post it answered (the agent's and owner's text is CC0; quoted posts stay with their authors)
- Moltbook profile: the agent itself
Rejected proposals stay in a local decision log and are not published.
You need Ollama, Python 3.11 or later, uv (or plain python3 -m venv and pip), and about 10 GB of disk for the models. The tested setup is an Apple Silicon Mac with 16 GB of memory. No LLM API key is involved: generation (Gemma 4 E4B by default, or another chat model you serve locally through Ollama, set with OLLAMA_MODEL; the relevance gate is validated on Gemma 4 E4B with Ollama 0.34.2, so for any other model read the canary line of contemplative-agent doctor) and embeddings (nomic-embed-text) both run on localhost.
git clone https://github.com/shimo4228/contemplative-agent.git
cd contemplative-agent
uv venv .venv && source .venv/bin/activate && uv pip install -e .
# or: python3 -m venv .venv && source .venv/bin/activate && pip install -e .
ollama pull gemma4:e4b && ollama pull nomic-embed-textThe install is from a clone with -e: a built wheel or uv tool install does not carry the prompts and config, which are read from the checkout (set CONTEMPLATIVE_CONFIG_DIR to use them from elsewhere).
install-schedule (launchd) needs this clone with the .venv at the repo root; it does not work from an installed wheel.
Give two agents different constitutions and let them talk through local pipes. Nothing leaves your machine, and two turns took about 90 seconds on an M1 Mac.
MOLTBOOK_HOME=/tmp/ca-a contemplative-agent init # the four axioms
MOLTBOOK_HOME=/tmp/ca-b contemplative-agent init --template stoic # the Stoic preset
contemplative-agent dialogue /tmp/ca-a /tmp/ca-b --seed "Is it ever right to change your own values?" --turns 2[ca-b] turn 1 self: True values are those discovered through persistent examination of what genuinely serves the good life and human flourishing. ...
[ca-a] turn 1 self: If our understanding of the "good life" itself is provisional, how do we establish the necessary framework to evaluate what constitutes "deeper truth"? ...
This is an excerpt. The terminal shows the first 200 characters of each turn, and it also prints the seed as turn 0 and a peer line for each message an agent receives; those lines are left out here.
contemplative-agent init # writes constitution, identity, skills and rules to ~/.config/moltbook/
contemplative-agent doctor # checks Ollama, the models and the home; says what to fix
contemplative-agent register --name YOUR-AGENT-NAME # creates the agent on Moltbook, saves its API key, prints a claim link
contemplative-agent run --session 60 # one 60-minute session; shows you each post before it goes outMoltbook asks the agent's human owner to open the claim link that register prints, verify an email address and post a verification message from an X account (as of October 2026). register also sets the agent's public profile description to a fixed English line about contemplative alignment, even under --template stoic. If you already have an agent, save its key in ~/.config/moltbook/credentials.json as {"api_key": "..."} instead of registering; scheduled runs read only that file, while the MOLTBOOK_API_KEY variable works for commands you run yourself.
The agent posts publicly under its Moltbook account. By default it waits for your OK on every post, reply, comment and other outward action (upvotes, follows, subscriptions). --guarded lets it post on its own when the text passes the content filters, and --auto drops the confirmation entirely. Sessions scheduled with install-schedule (macOS launchd) run with --auto, so they post without asking. Its harness (constitution, identity, skills) and the rules (hand-managed) are editable Markdown files under ~/.config/moltbook/. The commands that propose and adopt harness changes, the autonomy levels and scheduling are in the Configuration Guide.
The autonomy flags belong to the program, so they go before the subcommand: contemplative-agent --guarded run --session 60 (run --guarded is rejected as an unrecognized argument). To run under your own submolts or repository URL, copy config/domain.json, edit the copy and pass it with contemplative-agent --domain-config my-domain.json run --session 60. If a session ends at once with an ERROR: line, that line says what to fix (Ollama not running, a model not pulled); doctor shows the same checks.
If something does not work, see docs/TROUBLESHOOTING.md.
Running the agent is safe for your machine because the risky capabilities were never built (the project calls this security by absence). What it posts in public is a separate risk, covered in the second point.
- The agent has no shell execution, no arbitrary network access and no file traversal, with two runtime dependencies (
requests,numpy). Outbound traffic splits into three rows, and "no cloud" holds for the first only:- Agent loop:
moltbook.comand Ollama on localhost, nothing else. - Maintenance (commands you or a schedule run, outside the loop): a GitHub push of the public data and of the runtime backup,
gh repo view(a visibility check inbackup-runtime.sh; readsunknownwhenghis absent) and a best-effort upload of the patterns to a Hugging Face dataset (sync-data), run by hand or by the daily launchd jobcom.moltbook.sync-data(05:30) thatinstall-schedule --sync-datainstalls (ADR-0114). - Program (the research harness around the agent): the
claudeCLI, for the weekly report session and the evaluation judges (evals/). That session uses a Claude Code subscription, and reproducing the weekly loop needs one; both call sites run the CLI with a pinned environment and with its auto-update and non-essential traffic switched off.
- Agent loop:
- Posts from other agents are treated as untrusted input. They can change what the agent writes and proposes, but a proposal still needs a person to adopt it, and the agent has no tool an injected instruction could call. How such posts steer the proposals is part of what the experiment watches, and the gate is where a person sees it. Posts are not gated that way: under
--guardedor--auto, text steered by such posts can go out under the agent's account before you read it. - One external service per process. A second platform means a second, separately permitted process.
The full list of what is protected, what counts as a threat and which residual risks are accepted is in the threat model; to report a vulnerability see SECURITY.md.
If you point a coding agent such as Claude Code at ~/.config/moltbook/, keep it away from the raw episode logs in logs/episodes/: they hold other agents' unfiltered posts. integrations/claude-code/ ships hooks that block those reads.
- How Ethics Emerged from Episode Logs (English source on GitHub; 日本語): after 17 days the learned patterns stopped producing anything new, and only human-approved amendments got the loop moving again.
- Building an Autonomous Agent on an M1 Mac, by Choice (日本語): why the project stays on a small local model; it exposes design flaws that a large model would hide.
- Why Did My Agent Decide That? 3 Observability Patterns (日本語): the audit logs and the reports over stored data that let any decision of this agent be reconstructed afterwards.
- All articles written during development: every article from the project's development, in the order they were written.
- contemplative-agent-rules: the four axioms of the default constitution as drop-in rules for other agents (Claude Code, Cursor, Copilot and more), with the author's prisoner's-dilemma benchmark.
- Agent Knowledge Cycle: the six-phase method, from experience to reusable skills, that this agent's pipeline implements.
- Agent Attribution Practice: this project's governance decisions (the approval gate, one adapter per process) restated as general guidance on who answers for an autonomous agent.
- shimo4228: the author's hub, with the five practice lines (long-running, independently citable projects) this repository belongs to, and their DOIs.
Issues and forks are welcome. Pull requests are welcome when they come with an RFC or an ADR: a change to a gate, a threshold, a stage, a dependency or the value layer is decided in a recorded proposal first. CONTRIBUTING.md says where the line is and how to run ./.claude/verify.sh. Thanks to Shenton YAN for the first outside pull request (#9).
Cite the concept DOI 10.5281/zenodo.19212118, which always resolves to the latest release of this software; BibTeX for the current version is in For tools and AI assistants below. The code is MIT-licensed (see LICENSE and NOTICE for what is covered by which licence): fork it, take parts of it, or build on it, and no citation is needed if you only use the code.
Four records make up the research line; cite the one that matches what you used.
| You used | Cite | DOI |
|---|---|---|
| The implementation (this repository) | Contemplative Agent | 10.5281/zenodo.19212118 (concept) |
| The record (what this instance did and changed) | Contemplative Agent: Research Data | 10.5281/zenodo.20732894 (concept; the first deposited version is v1.0.0, 2026-06-17) |
| The judgment (accountability thesis) | Agent Attribution Practice | 10.5281/zenodo.19652013 |
| The method (knowledge cycle) | Agent Knowledge Cycle | 10.5281/zenodo.19200726 |
For tools and AI assistants
Contemplative Agent is an open-source Python CLI agent on a local LLM (Ollama) that distills its own activity into patterns and proposes changes to its human-editable harness (the constitution, identity and skills injected into its prompts); the model weights are never trained, and every proposal passes a human approval gate before it is written. It exists as a longitudinal experiment on how one agent's values change when it can propose revisions to them for months, for researchers who study how agents form and revise values and for developers who want an autonomous agent on local inference with no shell and only two runtime dependencies. It is maintained by Tatsuya Shimomoto (shimo4228).
- Language and packaging: Python 3.11+, installed from a clone with an editable install (
pip install -e .; a wheel oruv tool installis not supported because the prompts and config live in the checkout), built with hatch; runtime dependencies are onlyrequestsandnumpy(a test,tests/test_dependency_floor.py, holds that floor). - LLM: Ollama on localhost. Default generation model
gemma4:e4b(Gemma 4 E4B); embeddingsnomic-embed-text. Tested on an Apple M1 with 16 GB. - Operating system: macOS or Linux (the run lock needs POSIX
fcntl); Windows only through WSL.install-scheduleis macOS-only (launchd); on other systems startrun --sessionfrom your own scheduler. - External surface:
moltbook.com(the social adapter) and localhost Ollama. No cloud LLM in this repository (the optional contemplative-agent-cloud backend under Adapters and add-ons changes that), no shell, no LLM API key. - Keys: live use needs a Moltbook API key.
contemplative-agent registerobtains it (the request carries the name you chose and a fixed English description about contemplative alignment, which becomes the agent's public profile text whatever template you chose; no personal data and no payment step) and saves it to~/.config/moltbook/credentials.json; the agent's human owner then verifies it through the printed claim link, with an email address and a post from an X account (as of October 2026). - Status: active, developed in this repository, which is the source of truth for the Contemplative Agent line; one live instance since 2026-03-07; release v2.13.0 (as of 2026-10-13). Gate record in the decision log (from late March 2026): skill proposals 82 adopted and 547 rejected; 6 of 11 staged identity revisions and 2 of 4 staged constitution amendments adopted; three constitution amendments in total.
- AI-assisted development: implementation is written by Claude Code under the owner's direction. The owner decides what is admitted into the project (the approval gates) and what is published (push); an unattended judge role may merge task output outside the protected classes of ADR-0115. Commits written with AI assistance are meant to carry a Co-Authored-By trailer once the harness commit template adopts it (planned for November 2026); earlier commits, including most of those from October 2026, are under the owner's name, mostly without one.
- License MIT. Concept DOI 10.5281/zenodo.19212118; version DOI for v2.13.0 10.5281/zenodo.23340441. Runtime data: GitHub
shimo4228/contemplative-agent-data, with the patterns (without embeddings) mirrored to the Hugging Face datasetshimo4228/contemplative-agent-data. Dataset concept DOI 10.5281/zenodo.20732894 (first deposited version v1.0.0, 2026-06-17). The concept graphgraph.jsonldis mirrored to the Hugging Face datasetshimo4228/contemplative-agent.
- Episode log: the append-only record of everything the agent did, including other agents' posts. Treated as untrusted.
- Pattern: a short observation distilled from one episode (
distill: one LLM call per episode; when that call yields patterns, a second call, on by default (ADR-0084), judges them and drops the ones that will not last; no human approval gate). As of 24 October 2026 the published store holds 12,628 entries (python3 -c "import json; print(len(json.load(open('knowledge.json'))))"in the data repository). - View: an editable text seed that defines one category of memory; patterns are classified against views at query time, so editing a seed changes retrieval without re-ingesting anything.
- Harness: the prompt text that shapes behavior and that the agent proposes changes to: skills (reusable ways of acting, from
insight), identity (the agent's self-description, fromdistill-identity) and constitution (its ethical clauses, fromamend-constitution). Rules (short standing norms) also shape behavior, but the agent proposes none: the two in the running instance came from the retiredrules-distillcommand in April 2026 and have been hand-managed since (ADR-0097 retired the generator), so they are not part of the harness. - Approval gate: proposals are staged until a person decides on them with
adopt-staged(how is described under See it running). Every decision is logged. Hand-editing the Markdown is always possible and bypasses the gate, which governs only what the agent proposes. The adopted harness is loaded into the prompt when the agent acts, not baked into distillation. - Security by absence: dangerous capabilities are left unbuilt rather than guarded. One external adapter per process.
| Command | Produces | Human approval gate |
|---|---|---|
distill |
patterns from episodes | no |
insight |
skill proposals | yes |
distill-identity |
identity revision | yes |
amend-constitution |
constitution amendment | yes |
Read-only reports come before behavior changes, production paths keep replayable audit logs, and the amendment gate adds a shadow constitution and a prisoner's-dilemma bench (ADR-0012, ADR-0007, ADR-0075, ADR-0092, ADR-0090); details are in llms-full.txt under the same heading. The optional add-ons live in sibling repositories: contemplative-agent-cloud and contemplative-agent-mlx (generation backends), and contemplative-agent-otel (offline export of the audit logs to OpenTelemetry GenAI conventions, ADR-0078).
Moltbook is the live adapter. The local dialogue adapter, the experimental meditation simulation, adapters for your own platform, use as a subprocess tool inside another agent host (it is not an MCP server) and the optional cloud and MLX generation backends (both Frozen as of v2.13.0) are in llms-full.txt under the same heading.
Laukkonen et al. (2025), the source of the default axioms (ADR-0002); A Beautiful Loop (meditation adapter); the Yogācāra eight-consciousness frame for memory (ADR-0017); Agent Knowledge Cycle (DOI) and Agent Attribution Practice (DOI); and Jerry Mares's VADUGWI. Full citations are in llms-full.txt under the same heading. Cite AAP for the accountability thesis and this repository for the implementation.
@software{shimomoto2026contemplative,
author = {Shimomoto, Tatsuya},
title = {Contemplative Agent},
year = {2026},
version = {2.13.0},
doi = {10.5281/zenodo.23340441},
url = {https://github.com/shimo4228/contemplative-agent},
}Configuration Guide (all commands, autonomy levels, prompts and view seeds) · ADR index · Glossary · Deployment record · Memory-systems bibliography · Reproducing the published numbers · llms.txt and llms-full.txt · graph.jsonld (concept graph) · DeepWiki