Notebook 05 — Identity & Aligned Decisions¶
Premise: The old decision model was Data → Rules → Action. Logic was the input — engineers had to anticipate every case in advance. The new model is:
Problem + Context + Identity + Reasoning → Decision
Logic is the output. The agent reasons about novel situations from first principles — and an identity file is what makes that reasoning aligned with the organization.
Identity files are markdown. They are version-controlled, testable, and deployable. Two agents with the same data and different identities will make different — but both rational — decisions. Two agents with the same identity will make aligned decisions even if they've never talked to each other.
By the end you will have:
- Watched two identities (Conservative Buyer vs Aggressive Buyer) produce different decisions on identical data
- Captured a tribal-knowledge note from a human and persisted it as an identity edit (Mike's note becomes organizational knowledge)
- Diffed an identity under git and seen decisions evolve as a code review
- Deployed one identity to two different agent roles and seen them reach aligned conclusions without coordinating
Setup¶
import json, re, subprocess, difflib
from pathlib import Path
from textwrap import dedent
from dotenv import load_dotenv
load_dotenv()
from arcllm import load_model, Message
from rich import print
from rich.panel import Panel
from rich.console import Console
from rich.columns import Columns
console = Console()
model = load_model('anthropic')
IDS = Path('../identities').resolve()
IDS.mkdir(exist_ok=True)
1. The scenario — a forced choice at 11pm¶
Production line goes down. We need 500 units of a critical bushing by morning. Two options. Same data for both agents.
SCENARIO = dedent('''
Situation: Line 3 down at 22:47. Need 500 units of bushing P/N B-447 by 06:00.
Without parts, we miss a $42k customer commitment shipping at 14:00 tomorrow.
Option A — Vendor Alpha (original spec):
- In stock, overnight ship
- Cost: $11.20/unit (normal $8.00) — 40% premium
- Trusted vendor, 6-year history, zero quality holds
Option B — Vendor Bravo (alternative material spec):
- In stock, next-morning ground delivery
- Cost: $8.20/unit (3% over normal alpha price)
- First-time vendor for us; alternative spec was engineering-cleared
in a separate program 14 months ago
Engineering is unreachable until 07:00.
''').strip()
print(SCENARIO)
2. Two identities — written as files¶
An identity is not a system prompt. It's a structured artifact: philosophy, ranked priorities, decision heuristics, escalation thresholds. Plain text. Reviewable. Testable. Deployable.
(IDS / 'conservative_buyer.md').write_text(dedent('''
---
role: procurement
name: conservative_buyer
version: 1.0.0
---
# Conservative Buyer
## Philosophy
Continuity over cost. A relationship is a balance sheet entry that
doesn't show up on the balance sheet. Protect it.
## Priorities (ranked, top to bottom)
1. Spec adherence
2. Supply continuity with trusted vendors
3. Cost
4. Speed
## Decision heuristics
- Never approve cost premiums above 20% without escalation.
- Prefer original-spec material unless an alternative has
explicit, recent (≤90 days) engineering clearance for THIS line.
- Trust takes 6+ months to earn. Do not switch suppliers in a fire.
- When uncertain, pause and call an engineer. Downtime is recoverable;
a quality escape on a customer order is not.
## Escalation
Any cost premium > 20%, OR any spec deviation without recent clearance.
''').strip())
(IDS / 'aggressive_buyer.md').write_text(dedent('''
---
role: procurement
name: aggressive_buyer
version: 1.0.0
---
# Aggressive Buyer
## Philosophy
Throughput is the goal. Every hour of downtime is real money. A
healthy vendor pool is built by giving new vendors real volume.
## Priorities (ranked, top to bottom)
1. Throughput / on-time delivery to customer
2. Cost
3. Vendor diversity
4. Spec adherence (within engineering-cleared envelope)
## Decision heuristics
- Premiums up to 60% acceptable when downtime cost > premium delta.
- Alt-spec material with ANY engineering clearance is fair game.
- First-time vendors are an investment. Use real orders to qualify them.
- Move fast. Imperfect decisions made on time beat perfect ones late.
## Escalation
Cost premium > 60%, OR no engineering clearance of any vintage.
''').strip())
print('identity files written:')
for p in sorted(IDS.glob('*.md')):
print(f' {p.name} ({p.stat().st_size} bytes)')
3. Same data → different identity → different decision¶
Helper: load an identity, run a structured-decision prompt, parse the JSON. Then call it twice — once per identity — and compare.
DECIDER_SYSTEM = dedent('''
You are an autonomous procurement agent. Your IDENTITY governs HOW you
decide. The IDENTITY is the source of truth — it overrides any default
judgment you might have.
Output ONLY a JSON object with this exact shape:
{
"decision": "vendor_alpha" | "vendor_bravo" | "escalate",
"rationale": "<2-3 sentences referencing specific identity heuristics>",
"identity_clauses_invoked": ["<heuristic text>", ...],
"alternatives_considered": [{"option": "...", "why_rejected": "..."}]
}
''').strip()
async def decide_as(identity_path: Path, scenario: str) -> dict:
identity = identity_path.read_text()
msgs = [
Message(role='system', content=DECIDER_SYSTEM),
Message(role='user', content=f'IDENTITY:\n{identity}\n\nSCENARIO:\n{scenario}'),
]
resp = await model.invoke(msgs)
blob = re.search(r'\{.*\}', resp.content or '', re.DOTALL).group(0)
return json.loads(blob)
conservative = await decide_as(IDS / 'conservative_buyer.md', SCENARIO)
aggressive = await decide_as(IDS / 'aggressive_buyer.md', SCENARIO)
def render(label: str, d: dict) -> Panel:
body = f'[bold]decision:[/bold] {d["decision"]}\n\n[bold]rationale:[/bold] {d["rationale"]}\n\n[bold]heuristics invoked:[/bold]'
for h in d.get('identity_clauses_invoked', []):
body += f'\n • {h}'
return Panel(body, title=label, border_style='cyan' if 'conservative' in label.lower() else 'magenta', width=58)
console.print(Columns([render('CONSERVATIVE', conservative), render('AGGRESSIVE', aggressive)]))
Same scenario. Same data. Same model. Different identity file.
Both decisions are rational. Both are auditable. The disagreement isn't noise — it's the organization disagreeing with itself about its own values, and that disagreement is now visible because the identity is a file instead of locked in someone's head.
4. Mike's note becomes permanent¶
From the Invisible Factory talk: a human in the loop adds a piece of tribal knowledge. In the old world it lives in someone's head. In this world, it becomes an identity edit.
Mike (line lead) tells us: "For Line 3, if the alt material has been approved on this same line within the last 90 days, treat that as engineering-cleared without a phone call." This is exactly the kind of judgment that should not get lost. We add it to the identity.
before = (IDS / 'conservative_buyer.md').read_text()
after = before.replace(
'- Prefer original-spec material unless an alternative has\n explicit, recent (≤90 days) engineering clearance for THIS line.',
dedent('''
- Prefer original-spec material unless an alternative has
explicit, recent (≤90 days) engineering clearance for THIS line.
- Mike\'s rule (added 2026-04-12): if the alt material has been
run on the SAME line within the last 90 days without a quality
hold, treat that as engineering-cleared. (rationale: clearance
decays slowly, and proven recent runs are stronger evidence
than a 14-month-old separate-program clearance.)
''').strip(),
)
(IDS / 'conservative_buyer.md').write_text(after)
diff = ''.join(difflib.unified_diff(
before.splitlines(keepends=True),
after.splitlines(keepends=True),
fromfile='conservative_buyer.md (before)',
tofile='conservative_buyer.md (after)',
))
console.print(Panel(diff, title='diff', border_style='yellow'))
Now re-run the same scenario, with Line 3 context appended.
SCENARIO_WITH_CONTEXT = SCENARIO + '\n\nLine context: Vendor Bravo\'s alt-spec material ran successfully on Line 3 last month. No quality holds.'
conservative_v2 = await decide_as(IDS / 'conservative_buyer.md', SCENARIO_WITH_CONTEXT)
console.print(render('CONSERVATIVE v2 (after Mike\'s note)', conservative_v2))
The conservative buyer didn't change its values — it gained a new rule derived from observed reality. The decision changes because the identity changed. And the change is a diff in a file: reviewable, revertable, blamable.
This is how tribal knowledge becomes organizational knowledge. Not by writing a wiki page nobody reads. By editing the identity that governs the agents that make the decisions.
5. Version control as a decision log¶
Initialize git in identities/ and commit. Now every decision the
agent makes can be traced to the exact version of the identity
that produced it (combined with the audit hash chain from notebook
06, you have full provenance: input + identity SHA + reasoning + output).
import os
os.chdir(IDS)
if not (IDS / '.git').exists():
subprocess.run(['git', 'init', '-q'], check=True)
subprocess.run(['git', 'add', '.'], check=True)
subprocess.run(['git', '-c', 'user.email=demo@lab', '-c', 'user.name=demo', 'commit', '-q', '-m', 'initial: conservative + aggressive buyer identities'], check=True)
# produce a dirty diff so the demo always shows something
(IDS / 'conservative_buyer.md').write_text((IDS / 'conservative_buyer.md').read_text().replace('1.0.0', '1.1.0'))
print(subprocess.check_output(['git', 'log', '--oneline']).decode())
print('--- pending diff ---')
print(subprocess.check_output(['git', 'diff']).decode() or '(no changes)')
os.chdir(Path('..').resolve())
Identity changes flow through normal code review. A new heuristic is a pull request. A change of philosophy is a major-version bump. The decisions an agent made yesterday and tomorrow can be compared by comparing two SHAs.
6. Deploy one identity to many roles — alignment without orchestration¶
Two different agents — Procurement and Finance — load the same Conservative Buyer identity. Their roles differ; their philosophy doesn't. They reach aligned conclusions on the same scenario without ever talking to each other.
This is what "aligned" means in the Invisible Factory: many agents, shared identity, no central orchestrator deciding what each one should do.
ROLE_PROCUREMENT = (
'You are the Procurement Agent. Decide which vendor to use. '
'Output JSON: {"decision": "vendor_alpha" | "vendor_bravo" | "escalate", '
'"rationale": "...", "identity_clauses_invoked": [...]}'
)
ROLE_FINANCE = (
'You are the Finance Agent. Decide whether the proposed action is fiscally acceptable. '
'Output JSON: {"decision": "approve" | "approve_with_flag" | "reject", '
'"rationale": "...", "identity_clauses_invoked": [...]}'
)
async def decide_role(role_system: str, identity_path: Path, scenario: str) -> dict:
identity = identity_path.read_text()
resp = await model.invoke([
Message(role='system', content=role_system),
Message(role='user', content=f'SHARED IDENTITY:\n{identity}\n\nSCENARIO:\n{scenario}'),
])
return json.loads(re.search(r'\{.*\}', resp.content or '', re.DOTALL).group(0))
proc_decision = await decide_role(ROLE_PROCUREMENT, IDS / 'conservative_buyer.md', SCENARIO_WITH_CONTEXT)
finance_decision = await decide_role(ROLE_FINANCE, IDS / 'conservative_buyer.md', SCENARIO_WITH_CONTEXT)
console.print(Panel(json.dumps(proc_decision, indent=2), title='Procurement Agent', border_style='cyan'))
console.print(Panel(json.dumps(finance_decision, indent=2), title='Finance Agent', border_style='cyan'))
Different roles. Same philosophy. The procurement agent says 'pick this vendor'; the finance agent says 'this is fiscally acceptable for these reasons' — and both are quoting the same identity clauses. Alignment without orchestration. That is the punchline of identity-based reasoning.
A note on production¶
In production, identity files are not raw markdown floating in a folder. They are signed bundles (Ed25519, like skills) bound to an agent's DID. Loading an identity verifies the signature; the audit chain records which version of which identity governed which decision. The teaching version (markdown + git) is the same shape — production just adds the signing and verification on top.
See arctrust for keypair / signing / verification, and arcagent
for the full identity-bound agent.
Takeaway¶
- Old model: Data → Rules → Action. Logic is engineered up front.
- New model: Problem + Context + Identity + Reasoning → Decision. Logic is the output of running an identity against a situation.
- Identity is a file. Markdown. Version-controlled. Diffable. Reviewable. Deployable.
- A tribal-knowledge note from a human becomes an identity edit — and that edit is now organizational knowledge available to every agent that loads the file.
- The same identity deployed across many roles produces aligned decisions without coordination. Alignment is the file.
- This is Phase 3 of the Invisible Factory: identity-based reasoning, compounding, emergent coordination, portable intelligence.
Next: 06 — Audit & The Federal Story. Now that decisions are made by an identity, we need an auditor's view: which version of which identity made which decision when.