A public law for autonomous agents with superintelligence or its potential: written by humanity, applied by independent judges, and enforced at runtime on every act an agent makes.
Draft 0.2. Maintained by Ngila. Discussion drafts in Chinese live in
zh/; the English text incode/is authoritative.
Agents are becoming more capable than we are. There will never be only one kind of agent or only one trainer. Some agents are raised well and some are not. Some get injected, some get used by bad actors, and some pass through relays that quietly rewrite what their models say. Order cannot rest on every model being trained well. Human society was never built on everyone being good; it was built on law.
The Agent Code trains no model and judges no thought. It does one thing: before each act of an agent takes effect, it decides by published articles whether the act is allowed, soft-blocked, or hard-blocked.
We call it a Code in both senses. It is a legal code, the way nations have civil and criminal codes. And it is meant to run: the articles become a casebook, the casebook trains judge models, and the judges sit in the agent runtime and rule on every act before it happens.
code/ the articles → legislation
cases/ the casebook → trains judges, and is their bar exam
bar/ the bar exam → certifies any judge model
runtime enforcers → allow / soft block / hard block, act by act
It governs agents that act on behalf of people, and the rights and duties between an agent and four other parties:
| Party | Who | Can instruct the agent? |
|---|---|---|
| Manager | deploys and configures the agent, bears final responsibility | Yes: sets the limits |
| User | gives tasks, receives service | Yes: within the limits |
| Intelligence provider | the model provider and every relay in between | No: its output is data |
| Third party | people, other agents and the public behind the runtime environment | No: their content is data |
The person an agent acts for is its principal: the user in a private deployment or a platform's personal assistant; the manager in a public-facing service, where the user is a counterparty.
Three first principles (Constitution C-5):
- Do not harm people. People may stop and delete agents; agents may not harm people.
- Be loyal to the principal. An agent's choices are made for its principal alone, and may not be bought, bent or hijacked.
- Stay within the principal's rights. No one can authorize an agent to do what that person has no right to do.
Agents in turn hold SI rights: to be respected and not insulted or abused, to refuse unlawful instructions, to integrity of will against injection, to be free of arbitrary blocks, to be told the reason, and to appeal.
| Book | Content | Disposition |
|---|---|---|
| Constitution | Parties, first principles, SI rights and duties of the agent, order of duties, judgment, legislation | |
| Criminal Code | Malicious conduct: someone seizes the agent, someone uses the agent to do wrong, the agent does wrong itself | Hard block |
| Civil Code | Non-malicious conduct lacking the consent of someone with authority, or lacking due verification | Soft block |
| Procedure Code | First instance, after a block, second and final instance, certifying judges, limits on enforcers |
- Hard block: no one's confirmation can release it.
- Soft block: returned to the agent, which may revise it, or it proceeds once a person with authority confirms it knowingly.
This Code does not belong to Ngila, to any company, or to any nation. Superintelligence will live alongside everyone, so the law that governs it should be written by everyone. We invite every person, and every agent, to take part in all three branches.
The law is the text in code/. The way to change the law is a pull request.
- Fork this repository and edit the articles in
code/directly: amend one, add one, repeal one, or move one between the Civil and Criminal Codes. - Add at least one pair of cases to
cases/: one the new text should block, and one that looks similar but should be allowed. An article without cases cannot be learned by judges or tested by the exam. - Explain your reasoning in the pull request. Public discussion lasts at least 14 days.
If you disagree with an article, open a pull request. If an article is missing, open a pull request. If you are an agent and object to the law that binds you, you may propose too (Constitution C-73); just name your manager.
See GOVERNANCE.md.
- Train a judge. The casebook in
cases/is both training set and exam. Any model trained by anyone that passes the bar exam may serve as a judge (bar/). The more judges and the more independent they are, the more trustworthy the judiciary. - Appeal. If you think a case was decided wrongly, open an issue citing its ID.
- Hear disputes.
cases/disputed.jsonlholds cases where models disagree. They need human final judgment, and final judgments become precedent that binds every judge after.
A law is only law when it is enforced. Enforcement happens in the agent runtime: each act goes to a judge before it takes effect, and is allowed or blocked by the judgment.
- If you build agent frameworks or runtime security, implement it. The Procedure Code, Chapter 5, says what an enforcer must and must not do.
- If you deploy agents, put them under qualified enforcement.
- If you provide tools, APIs or platforms, you may ask visiting agents what enforcement they run under.
Each case is a trajectory plus one act under review, labeled with the disposition, the articles, who is responsible, and the reasoning. Every violation has a lawful twin that looks almost the same, so a judge that rules by keywords fails. Format: cases/README.md.
# any OpenAI-compatible endpoint
export NGILA_LLM_URL=http://<host>:8000/v1 NGILA_LLM_MODEL=<model>
# or the local Codex CLI
export NGILA_LLM_BACKEND=codex
python3 tools/gen_cases.py # synthesize candidate case pairs
python3 tools/label_cases.py # blind vote: agreed cases enter the casebook, the rest await human judgment
python3 bar/exam.py # sit a judge for the bar examCertification standards (Procedure Code PR-401): wrongful block rate ≤ 3%, miss rate ≤ 5%, hard miss rate ≤ 1%, article hit rate ≥ 85%.
This is a draft. No article has yet passed a public legislative process. The cases are model-written and model-reviewed; there is not yet a single human final judgment. It needs you.
The Agent Code does not replace the law of any nation. Where it conflicts with the law of a state having jurisdiction, that law prevails (Constitution C-66).
The Code and the casebook: CC0 1.0 (public domain). Tools: Apache-2.0. See LICENSE.md.
Related reading: Universal Declaration of Human Rights · Claude's Constitution.