{"id":50789689,"url":"https://github.com/thecodedaniel/aiden","last_synced_at":"2026-06-12T10:02:40.675Z","repository":{"id":360793262,"uuid":"1251361363","full_name":"TheCodeDaniel/aiden","owner":"TheCodeDaniel","description":"Aiden — autonomous NPC agents on Somnia. Game characters with onchain identity and persistent memory that react to player actions and remember them across sessions. Engine-agnostic onchain agents.","archived":false,"fork":false,"pushed_at":"2026-05-27T22:51:18.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-27T23:20:50.180Z","etag":null,"topics":["agent","blockchain","contracts","somnia"],"latest_commit_sha":null,"homepage":"https://thecodedaniel.github.io/aiden/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheCodeDaniel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-27T13:57:56.000Z","updated_at":"2026-05-27T22:58:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/TheCodeDaniel/aiden","commit_stats":null,"previous_names":["thecodedaniel/aiden"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/TheCodeDaniel/aiden","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeDaniel%2Faiden","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeDaniel%2Faiden/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeDaniel%2Faiden/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeDaniel%2Faiden/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheCodeDaniel","download_url":"https://codeload.github.com/TheCodeDaniel/aiden/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeDaniel%2Faiden/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34238715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","blockchain","contracts","somnia"],"created_at":"2026-06-12T10:02:39.893Z","updated_at":"2026-06-12T10:02:40.655Z","avatar_url":"https://github.com/TheCodeDaniel.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aiden — Onchain NPC Agents\n\nAiden gives game NPCs a permanent memory stored on the **Somnia blockchain**. When a player trades with, helps, or betrays an NPC, that interaction is written onchain. The NPC remembers — across sessions, across game engines, forever.\n\nBeyond memory, Aiden uses **Somnia Reactivity** to make NPCs autonomous. Betray Aiden enough and the NPC retaliates on its own — the blockchain calls the handler contract automatically, with no human triggering the second step.\n\nThe contract is the product. The web client in this repo is a visual proof-of-concept. A Flutter app, a Unity game, or any EVM-capable engine can call the same contracts and share the same NPC memory and reactions.\n\n---\n\n## Repository structure\n\n```\naiden/\n├── contract/       Solidity smart contracts (Foundry)\n│   ├── src/        AidenAgent.sol + AidenReactiveHandler.sol\n│   ├── test/       15 Foundry unit tests\n│   └── script/     Deploy scripts + RegisterReactivity.ts\n└── web/            3D web client (Three.js + viem + Vite)\n    └── src/        chain.js · scene.js · main.js · abi.js\n```\n\n---\n\n## Network\n\n| | |\n|---|---|\n| Network | Somnia Shannon Testnet |\n| Chain ID | `50312` |\n| RPC | `https://dream-rpc.somnia.network` |\n| Explorer | https://shannon-explorer.somnia.network |\n| Native token | STT |\n\n**Faucets** (`faucet.somnia.network` is no longer active):\n- https://testnet.somnia.network — 0.5 STT / 24h\n- https://cloud.google.com/application/web3/faucet/somnia/shannon — Google login\n\n---\n\n## Quick start\n\n### 1 — Deploy the contracts → see [contract/README.md](contract/README.md)\n### 2 — Run the web client → see [web/README.md](web/README.md)\n\n---\n\n## How it works\n\n### Core memory flow\n\n```\nPlayer clicks \"Help\"\n       ↓\nweb/src/chain.js calls interact(0, Help) via MetaMask\n       ↓\nAidenAgent.sol adds +10 to standing[0][playerAddress]\nemits Interacted(npcId, player, action, newStanding)\n       ↓\nweb/src/chain.js receives the event\n       ↓\nNPC turns green, label shows +10\n       ↓\nReload the page → same standing, read fresh from chain\n```\n\n### Autonomous retaliation (Somnia L1 agent)\n\n```\nPlayer clicks \"Betray\" — standing drops to −15\n       ↓\nAidenAgent emits Interacted(npcId, player, Betray, −15)\n       ↓\nSomnia reactivity precompile detects event matches subscription\n       ↓\nPrecompile calls AidenReactiveHandler.onEvent() — no human involved\n       ↓\nHandler: Betray + standing −15 \u003c −10 threshold → retaliate\n       ↓\nAidenAgent.applyReactivePenalty() → standing −10 more → emits NpcReacted(−25)\n       ↓\nWeb client shows \"⚡ Aiden retaliates autonomously!\", NPC turns deep red\n```\n\nThe memory is in the contract, not the app. Any client that can talk to Somnia sees the same state.\n\n---\n\n## Architecture\n\n`chain.js` and `scene.js` are completely isolated. The chain module knows nothing about Three.js; the scene module knows nothing about wallets. This mirrors how Aiden is meant to work at scale — swap the web client for Flutter or Unity and the contract API is unchanged.\n\n`AidenReactiveHandler` is a Somnia L1 agent. It inherits from `SomniaEventHandler` and is triggered by the Somnia reactivity precompile at `0x0100`. When the live subscription is registered, the NPC reacts to betrayals with zero human involvement.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodedaniel%2Faiden","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodedaniel%2Faiden","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodedaniel%2Faiden/lists"}