cmeta
AGENTS.md9 starsChanged 11 days agoApache-2.0View on GitHub
Guidance for AI coding agents working on cMeta itself (the cmeta Python package / CLI cx · cmeta). This is the engine; it executes artifacts (programs, models, datasets, tasks, notes, ...) that live in content repositories. Keep this file short, factual and current. cMeta (aka cX) is a small, portable framework for unifying, interconnecting and reusing code, data, models, agents and knowledge through one uniform interface: License: Apache-2.0. Python: 3.9–3.15. This repo ships the framework and a built-in content repository…
- Installs packages
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- add-cserver-pluginSkill
- add-pluginSkill
- add-repoSkill
- release-cmetaSkill
- use-cmeta-cliSkill
- use-cmeta-pythonSkill
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 94
Uniform interface: Every operation is access({'category': ..., 'command': ..., ...}).
- Very specific: line 137
Resolution model (alias / UID /
alias,UID): Every category and artifact has an alias *and* a stable 16-hex UID. - Distinctive: line 236
Keep runtime deps minimal — prefer stdlib.
- Very specific: line 243
Command return contract: Always a dict {'return': 0, ...} on success, {'return': >0, 'error': '...'} on failure.
- Distinctive: line 307
When you generate, modify or move code, metadata or scripts in this project:
- Very specific: line 341
Citing: If the work is research, or reuses the *concepts* (the uniform access() interface, alias+UID identity, content-addressed artifacts …
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — Working context for AI agents on the cMeta framework
Guidance for AI coding agents working on cMeta itself (the
cmetaPython package / CLIcx·cmeta). This is the engine; it executes artifacts (programs, models, datasets, tasks, notes, ...) that live in content repositories. Keep this file short, factual and current.
1. What this project is
cMeta (aka cX) is a small, portable framework for unifying, interconnecting and reusing code, data, models, agents and knowledge through one uniform interface:
- Python:
cm.access({'category': ..., 'command': ..., ...}) - CLI:
cx <category> <command> [args] [--flags]
License: Apache-2.0. Python: 3.9–3.15.
This repo ships the framework and a built-in content repository
(cmeta/internal-repo/) with foundational categories. All other artifacts live
in external repos (e.g. cmeta-aops).
What it is used for — worth knowing when you judge whether a change fits:
a research assistant for open science (R&D encoded as executable,
self-describing artifacts that agents and people both discover, compose and
extend); collaborative research, development and experimentation (shared
content repos, rename-safe alias,UID references that survive forks and time);
reproducible benchmarking and software/hardware co-design (portable toolchain
setup, builds and runs across OS and compute targets, content-addressed
caching); AI-agent operations; FastAPI services (CMetaAsync — the cserver
app and the cTuning.ai platform); and notes/journals/logs kept alongside the
automations they describe. Reference content repo:
cmeta-aops. Fuller version:
docs/motivation.md.
Practical consequence: prefer changes that keep the core small and uniform and push capability into categories/artifacts — that is what lets agents extend the system without modifying the engine.
2. Setup, build, test
pip install -e ".[dev]" # editable install with dev extras (or [all])
cmeta --version
python -m pytest tests # tests (pytest; testpaths=tests/, files test_*.py)
python -m pytest tests/test_utils_obj_parse_cmeta_core.py::test_name # single test
flake8 cmeta # lint
python -m build # build wheel + sdistThe commands above are cross-platform truth. Any Windows .bat wrappers around
them are the author's local workflow and are not tracked in this repository.
Runtime deps are intentionally minimal: pyyaml, requests, setuptools, wheel,
tabulate, tqdm, packaging. (File locks are the engine's own
cmeta.utils.files.PathLock since 0.34.0; filelock is no longer used; the
processes and the host's memory and cores are read with the standard library
since 0.38.12 - psutil is no longer a dependency.)
Useful environment variables
CMETA_HOME, CMETA_DEBUG=1, CMETA_LOG=DEBUG|INFO, CMETA_LOG_FILE=<path>,
CMETA_FAIL_ON_ERROR=yes, CMETA_VERBOSE=yes, CMETA_INTERNAL_REPO_PATH,
CMETA_PIP_INSTALL_ARGS, CMETA_INDEX_LOCK_TIMEOUT (seconds a write to the index waits for a running
reindex, 600), CMETA_LOCK_TIMEOUT (seconds a writer waits for the lock of a file, 30), and the
provenance stamped on new artifacts: CMETA_AUTHORS, CMETA_COPYRIGHT,
CMETA_GENERATOR (JSON: how the artifact was made; with the artifact_defaults of a repository's
_cmr.yaml - docs/using-cmeta.md §7.6).
3. Architecture (package cmeta/)
| Module | Role |
core.py | CMeta class + access() — the one dispatch every request funnels through. Resolves the category artifact, loads its API module, calls the matching command function. |
core_async.py | Async variant of access(). |
category.py | InitCategory base class every category API subclasses. Provides _prepare_input_from_params/ctx helpers used to re-enter cm.access(). |
category_api_v1.py | Standard base category — implements the shared CRUD commands every category inherits: find/list/read/update/create/delete/move/copy/migrate/info/tags/get/set/index/reindex/test. |
repos.py | Repos — index and resolve content repositories + artifacts (by alias / UID / tags / wildcards). Owns the per-category .pkl index files. |
packages.py | Packages — detect installed tools/versions and auto-install Python packages. |
config.py | Global cfg dict, param descriptors, env-var handling, command aliases (add→create, rm→delete, ls→list, search→find, mv→move, ...). |
cli.py | CLI entry points wired in pyproject.toml [project.scripts]: main_cmeta/main_meta/main_cx/main_cxt/main_cxai/main_cserver + u* variants that put a bare --home first. cxt = cx task run, cxai = cx task run run-ai. |
version.py | __version__ — single source of truth (wired via dynamic version in pyproject.toml). |
utils/ | Helpers: common, files, names (cmeta ref parsing), net, sys, cli. |
internal-repo/ | Built-in content repo shipped as package data (see §4). |
Core concepts implemented by the code
- Uniform interface. Every operation is
access({'category': ..., 'command': ..., ...}). Add functionality by extending categories/commands/hooks — not side entry points. ctx(context) dict. Created (or accepted) on the firstaccess(), threaded through every nested call as a shared bus. Framework keys:origin,nested_call,control,command,category,category_artifact,category_cmeta,last_self_time,repro. External callers (esp. AI agents) may attach namespaced state under their own key (ctx['agent'],ctx['trace'], ...); it survives across nested calls and is captured by--dump. Seedocs/using-cmeta.md §5.4.- Category. An artifact type; a folder with
_cmeta.yaml(category: category,dd9ea50e7f76467f) +api/v1.py. - Artifact. Any content identified by
_cmeta.yamlor_cmeta.json(UID, category ref, tags, features) inside a content repo. Optional_desc.yaml= automation pipeline (uses→prepend/append/update, referencing tasks byalias,UID). Optional per-artifactapi_v1.pyfor hooks. - Content repo. Directory with
_cmr.yaml(repo metadata). The framework indexes multiple repos and resolves refs across them. - Three repo tiers per
<CMETA_HOME>: (1) the shipped internal repo (cmeta/internal-repo/; overridable viaCMETA_INTERNAL_REPO_PATH), (2) a default local scratch repo auto-created at<CMETA_HOME>/repos/local/, (3) any user repos pulled/plugged in and listed in<CMETA_HOME>/repos.json.<CMETA_HOME>resolves in order:CMETA_HOME→VIRTUAL_ENV/CMETA→CONDA_PREFIX/CMETA→CMETA_HOME2→~/CMETA— swap the env var to keep separate collections per project. - Base vs. specific commands. A category inherits from
category_api_v1.pyand adds/overrides in its ownapi/v1.py. Pass--baseto force the base command; a categoryapi/v1.pymethod can delegate viaself._prepare_input_from_params(params, base=True)thenself.cm.access(...). - Command function naming (load-bearing).
core.pystrips trailing underscores from method names and picks call style by suffix:foo_(single trailing_, not__) → called with**command_params(typed kwargs incl.ctx). User invokes asfoo. Use this whenever you want typed args +ctx.foo/foo__/foo___→ called with one positionalparamsdict. Trailing__/___are stripped for the CLI name (used to avoid Python keyword/builtin clashes:list__,type__, ...).
- Command aliases. Global map in
config.cfg['command_aliases']; per-category overrides viacommand_aliases:in_cmeta.yaml. - Global CLI flags are declared in
cmeta/config.py(params_desc/params_command_desc/params_command2_desc/params_command3_desc/params_init_desc). Full user-facing reference indocs/using-cmeta.md§3 andREADME.md. - Resolution model (alias / UID /
alias,UID). Every category and artifact has an alias and a stable 16-hex UID. References accept all three forms; when both are given (alias,UID), the UID is authoritative (seerepos.py::find_in_indexandutils/names.py::parse_cmeta_name). This makesalias,UIDrefs rename-safe — safe for automations, cross-repo links and long-lived recipes. Cross-repo:<repo>:<name>. Full cRef:<category>::<artifact>. - Fast index +
--reindex. Per-category pickles at<CMETA_HOME>/index/<category>.pklbackfind/list/load. The framework refreshes automatically oncreate/update/deleteand oncx repochanges. If artifacts were touched outside cMeta, reindex with the narrowest command:cx <category> index <repo>:<artifact>registers a single folder you created by hand (mkdir+_cmeta.*);cx <category> reindex <artifact>rewrites the record of one artifact (or of several, with wildcards) from the meta file in its folder without writing anything — a meta edited by hand, a folder renamed, moved or copied in (its stale aliases are dropped, and the record of a folder that now holds another artifact; a folder it cannot find or one UID in two folders is an error that changes nothing);cx <category> update <repo>:<artifact>refreshes the entry too but rewrites the meta file (a new timestamp);cx repo reindex <repo>rescans one repository (its_cmr.yamland its artifacts) and leaves the others alone;cx --reindexrebuilds every pickle and is slow — keep it for a clearedCMETA_HOMEor a bulk change across repositories. Payload-only edits (api/,files/,src/,_desc.yaml) need no reindex. Categories withno_index: truein_cmeta.yamlare always found by filesystem scan. - Content-addressed task caching / reproducibility. Workflow caches keyed
by content live under the
cachecategory (cx cache show|clean|delete).--reprowritescmeta-repro-input.json/-output.json;--dumpwritescmeta-ctx.json. Determinism across heterogeneous environments is improved, not solved — ongoing R&D; don't overstate it in docs.
4. cmeta/internal-repo/ — the built-in content repo
_cmr.yaml → artifact: internal,21f6ce28893e4de8. Shipped as package data.
Artifacts live under internal-repo/<category>/<artifact>/. Categories
present:
app, asset, cache, category, config, docs, experiment, journal,
log, note, repo, report, research, result, script, tests,
utils, website, work.
Notable shipped artifacts:
app/cserver/— FastAPI-based local server (cx app run cserver, or thecserverconsole script). UsesCSERVER_HOST/CSERVER_PORT/CSERVER_FLAGSenv vars (seedefault_env+param_env_prefixin its_cmeta.yaml), plusCSERVER_SESSION_SECRET/CSERVER_SESSION_MAX_AGEfor the session cookie. Access control is read from thecserverconfig artifact, not from the environment:api_keys(a key per request or session) andpassword/password_sha256(one shared password asked once per browser, exempting loopback unlesspassword_allow_localsays otherwise). The password check is an HTTP middleware, so it covers pages, artifact files and AJAX alike; note that Starlette runs the most recently added middleware first, which is whySessionMiddlewareis registered after it insrc/app.py. Details:docs/using-cmeta.md§8.2.1./renders the page named bydefault_pagein the same config (/projectsby default) through_serve_page, the helper behind every/<page>route; when that page cannot be shown (none, missing, an error, a refusedapi_key) it falls back totemplates/welcome.html.category/cserver.projects/— the home page ofcserver(UID5c7646fb6db54600): everycserver.*category of every plugged repository, found throughcategory find cserver.*(no registry); those withweb_are cards, the rest a footnote. It leaves itself out of its cards, readshide_reposfrom thecserverconfig on every request, and takes?repo=<text>.cx cserver.projects pagesprints the same list. Details:docs/using-cmeta.md§8.2.2.category/category/— the category category itself (UIDdd9ea50e7f76467f). Itscreateis whatcx category add <name>invokes; it also copiesv1-template.pyinto the new category asapi/v1.py.category/repo/— repository management:get,clone,pull,checkout,status,unzip,zip,plug,unplug,space,list.category/utils/— setsskip_base_category_commands: true; exposes helper commands only (uid, uuid, json↔yaml, clipboard helpers, etc.).category/config/—get/set/unset/read/showfor cMeta config artifacts.
_cmeta.yaml / _cmeta.json fields (quick reference)
| Field | Meaning |
artifact | Artifact UID (or alias,UID). Required. |
category | Category reference (alias,UID). |
tags | List of strings for tag search. |
authors, copyright, creation_timestamp, last_update_timestamp | Provenance. |
permanent: true | Refuses delete (used for shipped foundational artifacts). |
no_index: true | Skip fast index; found by filesystem scan. |
last_api_version | Highest API version the category ships (loads api/v<n>.py). |
base_category_default_api_versions | Which base API version this category inherits from, per category API version. |
min_cmeta_version | Minimum cMeta version per category API version. |
skip_base_category_commands: true | Category doesn't inherit any base CRUD. |
command_aliases | Per-category CLI aliases (global ones in config.py). |
find_sort: false | Disable default alphabetical sort for find. |
uses_categories | Mapping <local-name>: <alias>,<UID> declaring cross-category dependencies. Read at runtime as self.cmeta['uses_categories'][name] — the recommended way for one category to reference another (rename-safe). |
default_env, param_env_prefix, config_name | Used by the app category to run applications with pre-configured env vars + a named config artifact. |
5. Conventions
- Keep runtime deps minimal — prefer stdlib; justify any new runtime dep.
- Preserve module docstring / copyright headers — never strip or rewrite them. See §5.1 below for the full attribution rule.
- The single uniform
access()surface is load-bearing — extend via categories/commands/api/v1.pyhooks and the dispatch, not ad-hoc entry points. version.pyis the one place the version lives; don't hard-code it elsewhere.- Command return contract. Always a dict
{'return': 0, ...}on success,{'return': >0, 'error': '...'}on failure. Useself.cm.error(...)or return the dict directly; callers check withself.cm.catch_error(r). - Cross-category calls. Inside
api/v1.py, useself.cm.access(...). Refer to other categories viaself.cmeta['uses_categories']['<name>']declared in your_cmeta.yaml, not by hard-coded alias. - Python 3.9–3.15 supported; avoid newer-only syntax.
- Tests:
tests/, filestest_*.py, pytest config inpyproject.toml. - Public Apache-2.0 framework — keep product vision/strategy prose out; public
docs describe functionality (
README.md,docs/installation.md,docs/using-cmeta.md).
5.0 Git workflow — sign-off, branch naming, PR titles
These rules hold for every commit, branch and pull request here, including those an AI agent creates on the author's behalf:
- Sign off every commit:
git commit -s -m "…". The-s/--signoffflag appends the DCOSigned-off-by:line certifying the Developer Certificate of Origin 1.1 (seeCONTRIBUTING.mdand theDCOfile). A DCO check runs on every pull request and an unsigned commit blocks the merge. If one slipped through, repair it before pushing:git commit --amend -s --no-editfor the last commit, orgit rebase --signoff <base>for a range. - End a commit or a PR made through cMeta (cxai / run-ai) with the cMeta attribution, in place of the
harness's own lines (no
Co-Authored-By:). A commit message ends, as its own paragraph before the sign-off, withOrchestrated by cMeta cxai and generated by <harness> <model>(e.g. "... generated by Claude Code Opus 5.5"; never the effort). A PR description ends with the line with the icons and the links, the harness without the model (another harness: its name, its link, its maker's GitHub avatar):<img src="https://ctuning.ai/static/images/logo-ctuning-single-tr.png" height="16"> Orchestrated with [cMeta](https://cTuning.ai/project/cmeta) [cxai](https://github.com/cTuningLabs/cmeta-aops), written with <img src="https://github.com/anthropics.png?size=32" height="16"> [Claude Code](https://claude.com/claude-code) - The maintainer, and AI agents working for the maintainer, commit on
dev. That means every agent session: Claude Code, Codex, OpenCode.- Workflow:
git switch dev && git pull --ff-only, then commit and push todev. One pull requestdev→maincarries the work tomain; after its merge commit,devis fast-forwarded tomain(docs/releasing.md). - Agents commit and push only when the maintainer explicitly says so. Develop and test, leave the changes uncommitted, show what changed, and wait for a go-ahead for that piece of work; one go-ahead does not carry over to the next. The same for anything that changes the remote: pull requests, branch deletions, tags, releases.
- Shared working copy: several sessions may share one, so stage only your
own files and check
git statusbefore committing. - Never push to
main.
- Workflow:
- Everyone else names PR branches
YYYYMMDD-<short-branch-name>and opens the pull request intodev. The name is the creation date first, then a short kebab-case topic, e.g.20260808-fix-repo-resolutionor20260808-add-repo-zip-support. The date prefix keeps branches chronologically sortable and makes a pile of open PRs analyzable. - Prefix the PR title with the date:
YYYYMMDD - <Title of PR>. The date, a spaced hyphen, then the normal human-readable title — e.g.20260808 - Fix repo resolution for mixed-case aliases. This is the subject line visible on GitHub, so the date ordering helps when scanning or scripting over the PR list (gh pr create --title "20260808 - …",gh pr list).- Which date: for
dev→main, the day the PR is opened; for a dated branch, the same date as its prefix (the day the work was branched, not the day it merges).
- Which date: for
5.1 Attribution, provenance and citation
cMeta is Apache-2.0, created and developed by Grigori Fursin and
cTuning Labs. This applies to work done by AI agents and LLM-based tools
exactly as it does to work done by people. See NOTICE, COPYRIGHT,
LICENSE, CITATION.cff.
When you generate, modify or move code, metadata or scripts in this project:
- Never remove or rewrite an existing copyright header or attribution. If
you split a module, carry its header into the new file. If you move an
artifact, keep its
authors/copyrightfields intact. New source files get the project's standard module docstring header:
""" <short module description> cMeta author and developer: (C) 2025-2026 Grigori Fursin See the cMeta COPYRIGHT and LICENSE files in the project root for details. """New artifacts and categories record provenance in their
_cmeta.yaml, the same way the shipped ones do:authors: '[Grigori Fursin](https://cTuning.ai/@gfursin)' copyright: 2025-2026 Grigori Fursin and cTuning Labs. See the cMeta COPYRIGHT and LICENSE files for details.In a downstream content repo, set
authors/copyrightto that repo's own owner instead — but keep any cMeta-derived material's original notices.- Reusing this code elsewhere. Apache-2.0 §4 requires retaining the
copyright, patent, trademark and attribution notices and reproducing the
NOTICEfile contents in the distribution. That obligation is not waived because the copying was done by an agent rather than a person. - Citing. If the work is research, or reuses the concepts (the uniform
access()interface, alias+UID identity, content-addressed artifacts and caching, the plugin/category model), cite the project —CITATION.cffanddocs/history.mdcarry the BibTeX and the related publications. The author welcomes citation and collaboration: https://cTuning.ai/@gfursin
The repo also ships an experimental llms.txt (the proposed
llmstxt.org convention) giving agents a curated map of
the project plus this attribution summary. It is a research/testing feature —
tool support is inconsistent and it overrides nothing in LICENSE, NOTICE or
this file.
5.2 Releasing
A release follows docs/releasing.md, whichever tool runs it; the Claude Code skill
release-cmeta points to the same file. Agents do the checks, the version bump (in every file that
carries the version), the build check, the PR, the tag and the release on request. Four steps belong to
the maintainer:
- picking the version;
- merging into
main; - the PyPI upload;
- deciding when users are told: the cTuning platform's
cmeta_last_version, whichcx --versionreads through the cTuning.ai API.
6. Pointers
- Public overview:
README.md - Install:
docs/installation.md - Using cMeta (repos, plugins, artifacts, reindex):
docs/using-cmeta.md - Sphinx docs source:
docs/ - Changelog:
CHANGELOG.md - Releasing:
docs/releasing.md - Skills for agents extending cMeta:
.claude/skills/use-cmeta-python— programmatic API surface,access(),ctx(agent state), base commands,cm.utils,cm.packagesuse-cmeta-cli— command-line usage, discovery, flags,ctxfrom CLI, scripting patternsadd-plugin— scaffold a new category & artifactsadd-repo— pull / init / plug content repositoriesrelease-cmeta— release a new version (points todocs/releasing.md)
- Lineage (background only): Collective Knowledge → Collective Mind → CMX → cMeta.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

