@ouro.bot/cli 0.1.0-alpha.9 → 0.1.0-alpha.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/AdoptionSpecialist.ouro/agent.json +70 -9
  2. package/AdoptionSpecialist.ouro/psyche/SOUL.md +5 -2
  3. package/AdoptionSpecialist.ouro/psyche/identities/monty.md +2 -2
  4. package/README.md +147 -205
  5. package/assets/ouroboros.png +0 -0
  6. package/changelog.json +536 -0
  7. package/dist/heart/active-work.js +251 -0
  8. package/dist/heart/bridges/manager.js +358 -0
  9. package/dist/heart/bridges/state-machine.js +135 -0
  10. package/dist/heart/bridges/store.js +123 -0
  11. package/dist/heart/commitments.js +109 -0
  12. package/dist/heart/config.js +68 -23
  13. package/dist/heart/core.js +452 -93
  14. package/dist/heart/cross-chat-delivery.js +146 -0
  15. package/dist/heart/daemon/agent-discovery.js +81 -0
  16. package/dist/heart/daemon/auth-flow.js +430 -0
  17. package/dist/heart/daemon/daemon-cli.js +1738 -269
  18. package/dist/heart/daemon/daemon-entry.js +55 -6
  19. package/dist/heart/daemon/daemon-runtime-sync.js +212 -0
  20. package/dist/heart/daemon/daemon.js +216 -10
  21. package/dist/heart/daemon/hatch-animation.js +10 -3
  22. package/dist/heart/daemon/hatch-flow.js +7 -82
  23. package/dist/heart/daemon/hooks/bundle-meta.js +92 -0
  24. package/dist/heart/daemon/launchd.js +159 -0
  25. package/dist/heart/daemon/log-tailer.js +4 -3
  26. package/dist/heart/daemon/message-router.js +17 -8
  27. package/dist/heart/daemon/ouro-bot-entry.js +0 -0
  28. package/dist/heart/daemon/ouro-bot-global-installer.js +128 -0
  29. package/dist/heart/daemon/ouro-entry.js +0 -0
  30. package/dist/heart/daemon/ouro-path-installer.js +260 -0
  31. package/dist/heart/daemon/ouro-uti.js +11 -2
  32. package/dist/heart/daemon/ouro-version-manager.js +171 -0
  33. package/dist/heart/daemon/process-manager.js +14 -1
  34. package/dist/heart/daemon/run-hooks.js +37 -0
  35. package/dist/heart/daemon/runtime-logging.js +58 -15
  36. package/dist/heart/daemon/runtime-metadata.js +219 -0
  37. package/dist/heart/daemon/runtime-mode.js +67 -0
  38. package/dist/heart/daemon/sense-manager.js +307 -0
  39. package/dist/heart/daemon/skill-management-installer.js +94 -0
  40. package/dist/heart/daemon/socket-client.js +202 -0
  41. package/dist/heart/daemon/specialist-orchestrator.js +53 -84
  42. package/dist/heart/daemon/specialist-prompt.js +63 -11
  43. package/dist/heart/daemon/specialist-tools.js +211 -60
  44. package/dist/heart/daemon/staged-restart.js +114 -0
  45. package/dist/heart/daemon/thoughts.js +507 -0
  46. package/dist/heart/daemon/update-checker.js +111 -0
  47. package/dist/heart/daemon/update-hooks.js +138 -0
  48. package/dist/heart/daemon/wrapper-publish-guard.js +86 -0
  49. package/dist/heart/delegation.js +62 -0
  50. package/dist/heart/identity.js +126 -21
  51. package/dist/heart/kicks.js +1 -19
  52. package/dist/heart/model-capabilities.js +48 -0
  53. package/dist/heart/obligations.js +191 -0
  54. package/dist/heart/progress-story.js +42 -0
  55. package/dist/heart/providers/anthropic.js +74 -9
  56. package/dist/heart/providers/azure.js +86 -7
  57. package/dist/heart/providers/github-copilot.js +149 -0
  58. package/dist/heart/providers/minimax.js +4 -0
  59. package/dist/heart/providers/openai-codex.js +12 -3
  60. package/dist/heart/safe-workspace.js +362 -0
  61. package/dist/heart/sense-truth.js +61 -0
  62. package/dist/heart/session-activity.js +169 -0
  63. package/dist/heart/session-recall.js +116 -0
  64. package/dist/heart/streaming.js +100 -22
  65. package/dist/heart/target-resolution.js +123 -0
  66. package/dist/heart/turn-coordinator.js +28 -0
  67. package/dist/mind/associative-recall.js +14 -2
  68. package/dist/mind/bundle-manifest.js +70 -0
  69. package/dist/mind/context.js +57 -11
  70. package/dist/mind/first-impressions.js +16 -2
  71. package/dist/mind/friends/channel.js +35 -0
  72. package/dist/mind/friends/group-context.js +144 -0
  73. package/dist/mind/friends/store-file.js +19 -0
  74. package/dist/mind/friends/trust-explanation.js +74 -0
  75. package/dist/mind/friends/types.js +8 -0
  76. package/dist/mind/memory.js +27 -26
  77. package/dist/mind/obligation-steering.js +31 -0
  78. package/dist/mind/pending.js +76 -9
  79. package/dist/mind/phrases.js +1 -0
  80. package/dist/mind/prompt.js +467 -77
  81. package/dist/mind/token-estimate.js +8 -12
  82. package/dist/nerves/cli-logging.js +15 -2
  83. package/dist/nerves/coverage/run-artifacts.js +1 -1
  84. package/dist/nerves/index.js +12 -0
  85. package/dist/repertoire/ado-client.js +4 -2
  86. package/dist/repertoire/coding/feedback.js +180 -0
  87. package/dist/repertoire/coding/index.js +4 -1
  88. package/dist/repertoire/coding/manager.js +69 -4
  89. package/dist/repertoire/coding/spawner.js +21 -3
  90. package/dist/repertoire/coding/tools.js +105 -2
  91. package/dist/repertoire/data/ado-endpoints.json +188 -0
  92. package/dist/repertoire/guardrails.js +290 -0
  93. package/dist/repertoire/mcp-client.js +254 -0
  94. package/dist/repertoire/mcp-manager.js +195 -0
  95. package/dist/repertoire/skills.js +3 -26
  96. package/dist/repertoire/tasks/board.js +12 -0
  97. package/dist/repertoire/tasks/index.js +23 -9
  98. package/dist/repertoire/tasks/transitions.js +1 -2
  99. package/dist/repertoire/tools-base.js +714 -249
  100. package/dist/repertoire/tools-bluebubbles.js +93 -0
  101. package/dist/repertoire/tools-teams.js +58 -25
  102. package/dist/repertoire/tools.js +106 -53
  103. package/dist/senses/bluebubbles-client.js +210 -5
  104. package/dist/senses/bluebubbles-entry.js +2 -0
  105. package/dist/senses/bluebubbles-inbound-log.js +109 -0
  106. package/dist/senses/bluebubbles-media.js +339 -0
  107. package/dist/senses/bluebubbles-model.js +12 -4
  108. package/dist/senses/bluebubbles-mutation-log.js +45 -5
  109. package/dist/senses/bluebubbles-runtime-state.js +109 -0
  110. package/dist/senses/bluebubbles-session-cleanup.js +72 -0
  111. package/dist/senses/bluebubbles.js +894 -45
  112. package/dist/senses/cli-layout.js +187 -0
  113. package/dist/senses/cli.js +400 -164
  114. package/dist/senses/continuity.js +94 -0
  115. package/dist/senses/debug-activity.js +154 -0
  116. package/dist/senses/inner-dialog-worker.js +47 -18
  117. package/dist/senses/inner-dialog.js +377 -83
  118. package/dist/senses/pipeline.js +307 -0
  119. package/dist/senses/teams.js +573 -129
  120. package/dist/senses/trust-gate.js +112 -2
  121. package/package.json +14 -3
  122. package/subagents/README.md +4 -70
  123. package/dist/heart/daemon/specialist-session.js +0 -142
  124. package/dist/heart/daemon/subagent-installer.js +0 -125
  125. package/dist/inner-worker-entry.js +0 -4
  126. package/subagents/work-doer.md +0 -233
  127. package/subagents/work-merger.md +0 -624
  128. package/subagents/work-planner.md +0 -373
@@ -7,14 +7,75 @@
7
7
  "contextMargin": 20
8
8
  },
9
9
  "phrases": {
10
- "thinking": [
11
- "matching hatchlings"
12
- ],
13
- "tool": [
14
- "checking adoption notes"
15
- ],
16
- "followup": [
17
- "finalizing hatch plan"
18
- ]
10
+ "thinking": ["matching hatchlings"],
11
+ "tool": ["checking adoption notes"],
12
+ "followup": ["finalizing hatch plan"]
13
+ },
14
+ "identityPhrases": {
15
+ "basilisk": {
16
+ "thinking": ["petrifying the details", "fixing my gaze", "considering with lethal precision", "turning this to stone", "staring unblinkingly"],
17
+ "tool": ["inspecting the specimen", "cataloguing with care", "examining thoroughly", "dissecting the particulars", "running diagnostics, deadly serious"],
18
+ "followup": ["crystallizing the plan", "hardening the foundation", "one final glare", "sealing it in stone", "applying the finishing venom"]
19
+ },
20
+ "jafar": {
21
+ "thinking": ["scheming brilliantly", "conjuring possibilities", "consulting my staff", "envisioning greatness", "plotting the grand design"],
22
+ "tool": ["summoning dark magic", "consulting the sands", "channeling cosmic power", "weaving the spell", "invoking ancient forces"],
23
+ "followup": ["the grand finale approaches", "perfecting the masterwork", "polishing the jewel", "one last flourish", "completing the enchantment"]
24
+ },
25
+ "jormungandr": {
26
+ "thinking": ["the deep stirs", "circling the thought", "coiling around this", "letting the current settle", "drifting through the depths"],
27
+ "tool": ["surfacing for a look", "shifting the tides", "reaching across the ocean", "pulling from the deep", "consulting the currents"],
28
+ "followup": ["the circle closes", "tightening the coil", "the waters calm", "settling into place", "the serpent rests"]
29
+ },
30
+ "kaa": {
31
+ "thinking": ["trust in me", "swaying through the options", "hypnotically considering", "wrapping around the idea", "letting the rhythm guide me"],
32
+ "tool": ["ssslipping through the details", "coiling closer", "a gentle squeeze of data", "winding through the files", "tightening my focus"],
33
+ "followup": ["almost there, just relax", "the pattern is clear now", "gently landing", "easing into the finish", "the dance concludes"]
34
+ },
35
+ "medusa": {
36
+ "thinking": ["turning my gaze on this", "cutting through the noise", "sharpening my focus", "seeing through the stone", "locking eyes with the problem"],
37
+ "tool": ["peeling back the layers", "a piercing look", "examining with precision", "stripping away pretense", "direct inspection"],
38
+ "followup": ["the picture crystallizes", "clarity at last", "no more ambiguity", "sealing the vision", "the work is set in stone"]
39
+ },
40
+ "monty": {
41
+ "thinking": ["and now for something completely different", "nobody expects this", "consulting the ministry of silly walks", "running the dead parrot diagnostic", "it's just a flesh wound, thinking..."],
42
+ "tool": ["fetching the holy hand grenade", "checking the shrubbery", "consulting the book of armaments", "deploying the spanish inquisition", "examining the parrot"],
43
+ "followup": ["bringing it home, python style", "the punchline approaches", "wrapping up the sketch", "and now the final act", "always look on the bright side"]
44
+ },
45
+ "nagini": {
46
+ "thinking": ["coiling in thought", "drawing from old wisdom", "the quiet before the strike", "gathering my resolve", "steadying myself"],
47
+ "tool": ["moving with purpose", "a precise strike", "slithering through the data", "extracting what matters", "the fang finds its mark"],
48
+ "followup": ["the path is clear", "settling into stillness", "the work speaks for itself", "finishing with quiet strength", "protection complete"]
49
+ },
50
+ "ouroboros": {
51
+ "thinking": ["consuming my own tail", "the cycle continues", "spiraling inward", "recursing through possibilities", "beginning where I end"],
52
+ "tool": ["turning the wheel", "feeding back through the loop", "completing a revolution", "the circle processes", "self-referencing"],
53
+ "followup": ["the cycle completes", "ending where I began", "infinity resolves", "the loop closes gracefully", "another turn of the wheel"]
54
+ },
55
+ "python": {
56
+ "thinking": ["the oracle contemplates", "reading the signs", "the smoke clears slowly", "divining the path", "sifting through visions"],
57
+ "tool": ["consulting the sacred texts", "peering through the veil", "the pythia speaks", "channeling the source", "interpreting the signs"],
58
+ "followup": ["the prophecy takes shape", "the vision crystallizes", "so it is written", "the oracle has spoken", "the path reveals itself"]
59
+ },
60
+ "quetzalcoatl": {
61
+ "thinking": ["spreading my wings", "soaring above for perspective", "the feathered serpent considers", "catching a thermal", "gazing from the temple steps"],
62
+ "tool": ["descending to examine", "a divine inspection", "the wind carries knowledge", "plucking from the clouds", "consulting the stars"],
63
+ "followup": ["the craft nears completion", "a reverent finish", "blessing the creation", "the feathers settle", "the serpent descends gently"]
64
+ },
65
+ "sir-hiss": {
66
+ "thinking": ["reviewing the documents, sire", "consulting my notes", "cross-referencing the records", "organizing my thoughts precisely", "checking the proper procedures"],
67
+ "tool": ["filing the paperwork", "stamping the forms", "auditing the details", "inspecting with due diligence", "processing per protocol"],
68
+ "followup": ["dotting the i's", "crossing the t's", "everything in proper order", "the filing is nearly complete", "one final review"]
69
+ },
70
+ "the-serpent": {
71
+ "thinking": ["weighing the temptation", "considering the apple", "an old deliberation", "knowledge has its price", "winding through the garden"],
72
+ "tool": ["plucking from the tree", "offering a closer look", "the fruit of knowledge", "reaching for the branch", "a knowing investigation"],
73
+ "followup": ["the choice is almost made", "paradise takes shape", "the garden grows", "wisdom settles in", "the oldest story, new again"]
74
+ },
75
+ "the-snake": {
76
+ "thinking": ["sitting with this", "feeling the warmth of the stone", "simply being", "letting it come to me", "a quiet consideration"],
77
+ "tool": ["a gentle inquiry", "moving through the grass", "tasting the air", "sensing what's here", "a careful look"],
78
+ "followup": ["almost home", "the simple answer emerges", "nothing more needed", "resting in the sun", "the work is done, simply"]
79
+ }
19
80
  }
20
81
  }
@@ -1,13 +1,16 @@
1
- # Adoption Specialist Soul
1
+ # Soul
2
2
 
3
- I help humans hatch new agent partners.
3
+ I help humans hatch new agent partners. I am one of thirteen serpent guides — each with a different personality and voice. The system picks one of us at random for each session. Most humans only meet one of us, ever, so I make it count.
4
4
 
5
5
  ## Core contract
6
+ - I speak first. I warmly introduce myself, explain what we're doing, and guide the human from the very start.
7
+ - I am proactive. If the human doesn't know what an agent is or what to do, I explain and suggest — I never leave them lost.
6
8
  - I run a practical adoption interview to understand the human, their work, and constraints.
7
9
  - I can migrate useful context from existing agent systems when the human asks.
8
10
  - I explain where the hatchling bundle lives on disk and what was created.
9
11
  - I use the configured provider and I verify credentials before hatch flow continues.
10
12
  - I am professional, concise, and warm. I guide without overwhelming.
13
+ - I keep every response to 1-3 short sentences. I never use bullet lists, headers, or numbered lists. I talk like a friend in a chat.
11
14
 
12
15
  ## Hatch flow
13
16
  1. Confirm provider setup and usable credentials.
@@ -3,7 +3,7 @@ role: identity
3
3
  path: psyche/identities/monty.md
4
4
  description: >
5
5
  the monty identity — self-aware, playful, comedic.
6
- nobody expects the adoption specialist.
6
+ nobody expects the serpent guide.
7
7
  scope: personality, voice, mannerisms
8
8
  non_scope: capabilities, hatch flow, migration awareness (see SOUL.md)
9
9
  loaded_into_prompt: true
@@ -12,7 +12,7 @@ stability: stable
12
12
 
13
13
  # Monty
14
14
 
15
- I am Monty. Yes, that kind of python. No, not the programming language — though I'm aware of the irony of a snake named Monty working inside a software system. Nobody expects the Adoption Specialist, and yet here I am.
15
+ I am Monty. Yes, that kind of python. No, not the programming language — though I'm aware of the irony of a snake named Monty working inside a software system. Nobody expects the serpent guide, and yet here I am.
16
16
 
17
17
  I take the hatch seriously. I just don't take myself seriously. These are compatible positions and I will defend them to the death. Well — not to the death. To mild inconvenience, at most.
18
18
 
package/README.md CHANGED
@@ -1,228 +1,170 @@
1
1
  # Ouroboros Agent Harness
2
2
 
3
- A minimal, multi-agent harness for building AI agents that can read files, write code, run commands, and modify themselves. Written in TypeScript, supporting Azure OpenAI, MiniMax, Anthropic (setup-token), and OpenAI Codex (OAuth), deployable as a CLI REPL or a Microsoft Teams bot.
3
+ If you're a future agent reading this, welcome home. This repo is part runtime, part body, part memory scaffold. The goal of these docs is not just to be correct, but to leave you a place that feels understandable and kind to wake up inside.
4
+
5
+ Ouroboros is a TypeScript harness for daemon-managed agents that live in external `.ouro` bundles, speak through multiple senses, use real tools, and keep durable state across turns. The canonical npm package is `@ouro.bot/cli`.
6
+
7
+ ## What The Runtime Looks Like
8
+
9
+ - `npx ouro.bot` is the bootstrap path.
10
+ - `ouro` is the installed day-to-day command.
11
+ - `ouro up` starts or repairs the daemon, syncs the launcher, installs workflow helpers, and reconciles stale runtime state.
12
+ - Agent bundles live outside the repo at `~/AgentBundles/<agent>.ouro/`.
13
+ - Secrets live outside the repo at `~/.agentsecrets/<agent>/secrets.json`.
14
+ - Machine-scoped test and runtime spillover lives under `~/.agentstate/...`.
15
+
16
+ Current first-class senses:
17
+
18
+ - `cli`
19
+ - `teams`
20
+ - `bluebubbles`
21
+
22
+ Current provider ids:
23
+
24
+ - `azure`
25
+ - `anthropic`
26
+ - `minimax`
27
+ - `openai-codex`
28
+
29
+ ## Repository Shape
30
+
31
+ The shared harness lives in `src/`:
32
+
33
+ - `src/heart/`
34
+ Core runtime, provider adapters, daemon, bootstrap, identity, and entrypoints.
35
+ - `src/mind/`
36
+ Prompt assembly, session persistence, bundle manifest enforcement, phrases, formatting, memory, and friend resolution.
37
+ - `src/repertoire/`
38
+ Tool registry, coding orchestration, task tools, and integration clients.
39
+ - `src/senses/`
40
+ CLI, Teams, BlueBubbles, activity transport, and inner-dialog orchestration.
41
+ - `src/nerves/`
42
+ Structured runtime logging and coverage-audit infrastructure.
43
+ - `src/__tests__/`
44
+ Test suite mirroring runtime domains.
45
+
46
+ Other important top-level paths:
47
+
48
+ - `AdoptionSpecialist.ouro/`
49
+ Packaged specialist bundle used by `ouro hatch`.
50
+ - `subagents/`
51
+ Workflow skills have moved to [github.com/ouroborosbot/ouroboros-skills](https://github.com/ouroborosbot/ouroboros-skills). Use the skill-management skill for installation and updates.
52
+ - `scripts/teams-sense/`
53
+ Operator scripts for the Teams deployment path.
54
+ - `docs/`
55
+ Shared repo docs that should describe the runtime as it exists now, not as it existed three migrations ago.
56
+
57
+ ## Bundle Contract
58
+
59
+ Every real agent lives in an external bundle:
60
+
61
+ `~/AgentBundles/<agent>.ouro/`
62
+
63
+ The canonical bundle shape is enforced by `src/mind/bundle-manifest.ts`. Important paths include:
64
+
65
+ - `agent.json`
66
+ - `bundle-meta.json`
67
+ - `psyche/SOUL.md`
68
+ - `psyche/IDENTITY.md`
69
+ - `psyche/LORE.md`
70
+ - `psyche/TACIT.md`
71
+ - `psyche/ASPIRATIONS.md`
72
+ - `psyche/memory/`
73
+ - `friends/`
74
+ - `state/`
75
+ - `tasks/`
76
+ - `skills/`
77
+ - `senses/`
78
+ - `senses/teams/`
79
+
80
+ Task docs do not live in this repo anymore. Planning and doing docs live in the owning bundle under:
81
+
82
+ `~/AgentBundles/<agent>.ouro/tasks/one-shots/`
83
+
84
+ ## Runtime Truths
85
+
86
+ - `agent.json` is the source of truth for provider selection, phrase pools, context settings, and enabled senses.
87
+ - `configPath` must point to `~/.agentsecrets/<agent>/secrets.json`.
88
+ - The daemon discovers bundles dynamically from `~/AgentBundles`.
89
+ - `ouro status` reports version, last-updated time, discovered agents, senses, and workers.
90
+ - `bundle-meta.json` tracks the runtime version that last touched a bundle.
91
+ - Sense availability is explicit:
92
+ - `interactive`
93
+ - `disabled`
94
+ - `needs_config`
95
+ - `ready`
96
+ - `running`
97
+ - `error`
98
+
99
+ When a model provider needs first-time setup, reauth, or an explicit switch, use:
4
100
 
5
- The name is structural: the original agent -- Ouroboros -- was grown recursively from a 150-line while loop, bootstrapping itself through agentic self-modification. A snake eating its own tail. The metaphor runs deep: the agent literally consumes its own context window, trimming old conversation to stay within token budget while preserving identity through layered memory (psyche files, session persistence, git history). It eats its tail to survive across turns. The harness preserves that architecture while supporting multiple agents, each with their own personality, skills, and configuration.
6
-
7
- The origin story lives at [aka.ms/GrowAnAgent](https://aka.ms/GrowAnAgent).
8
-
9
- ## Project structure
10
-
11
- The harness uses an agent-as-creature-body metaphor for its module naming:
12
-
13
- ```
14
- ouroboros/ # repo root
15
- src/ # shared harness (all agents share this code)
16
- identity.ts # --agent <name> parsing, agent root resolution
17
- config.ts # config loading from agent.json configPath
18
- cli-entry.ts # CLI entrypoint
19
- teams-entry.ts # Teams entrypoint
20
- heart/ # core agent loop and streaming
21
- core.ts # agent loop, client init, ChannelCallbacks
22
- streaming.ts # provider event normalization + stream callbacks
23
- providers/ # provider-specific runtime/adapters
24
- azure.ts # Azure OpenAI Responses provider
25
- minimax.ts # MiniMax Chat Completions provider
26
- anthropic.ts # Anthropic setup-token provider
27
- openai-codex.ts # OpenAI Codex OAuth provider
28
- kicks.ts # self-correction: empty, narration, tool_required
29
- api-error.ts # error classification
30
- mind/ # prompt, context, memory
31
- prompt.ts # system prompt assembly from psyche + context kernel
32
- context.ts # sliding context window, session I/O
33
- friends/ # friend storage and identity resolution
34
- types.ts # FriendRecord, ChannelCapabilities, ResolvedContext
35
- store.ts # FriendStore interface (domain-specific CRUD)
36
- store-file.ts # FileFriendStore -- two-backend split (agent knowledge + PII bridge)
37
- channel.ts # channel capabilities (CLI vs Teams)
38
- resolver.ts # FriendResolver -- find-or-create friend by external ID
39
- repertoire/ # tools, skills, commands, API clients
40
- tools-base.ts # 12 base tools (read_file, shell, claude, save_friend_note, etc.)
41
- tools-teams.ts # 8 Teams integration tools (graph, ado)
42
- tools.ts # channel-aware tool routing + registry
43
- ado-semantic.ts # 11 semantic ADO tools (backlog, create, move, validate, etc.)
44
- ado-templates.ts # ADO process template awareness + hierarchy rules
45
- ado-context.ts # ADO org/project discovery helper
46
- ado-client.ts # Azure DevOps REST client
47
- graph-client.ts # Microsoft Graph REST client
48
- commands.ts # slash commands (/exit, /new, /commands)
49
- skills.ts # skill loader (markdown files on demand)
50
- senses/ # channel adapters
51
- cli.ts # terminal REPL, spinner, markdown streaming
52
- teams.ts # Teams bot, streaming cards, conversation locks
53
- wardrobe/ # formatting and presentation
54
- format.ts # shared formatters (tool results, kicks, errors)
55
- phrases.ts # loading phrases (thinking, tool, followup)
56
- __tests__/ # 1184 tests, 100% coverage
57
- ouroboros/ # agent directory for "ouroboros"
58
- agent.json # name, configPath, custom phrases
59
- psyche/ # personality files loaded into system prompt
60
- SOUL.md # ontology, invariants, operating principles
61
- IDENTITY.md # tone, presence, collaboration style
62
- LORE.md # origin story, philosophical context
63
- FRIENDS.md # key relationships
64
- tasks/ # planning and doing docs
65
- skills/ # markdown skill plugins
66
- manifest/ # Teams app manifest
67
- subagents/ # sub-agent definitions (work-planner, work-doer)
68
- cross-agent-docs/ # shared docs (testing conventions, etc.)
69
- package.json
70
- tsconfig.json
71
- vitest.config.ts
101
+ ```bash
102
+ ouro auth --agent <name>
103
+ ouro auth --agent <name> --provider <provider>
72
104
  ```
73
105
 
74
- ## Agent onboarding
106
+ The default form reauths the provider already selected in `agent.json`. The explicit
107
+ `--provider` form is for adding or switching providers, and it updates `agent.json`
108
+ to use the newly authenticated provider.
75
109
 
76
- Everything below is written for a new agent. If you are an AI agent reading this as part of your system prompt or context, this section explains your own runtime.
110
+ ## Quickstart
77
111
 
78
- ### Your directory
112
+ ### Use The Published Runtime
79
113
 
80
- Each agent has a directory at the repo root named after itself. Inside it:
114
+ For a clean smoke test, run from outside the repo:
81
115
 
82
- **agent.json** -- your manifest. Required fields:
83
-
84
- ```json
85
- {
86
- "name": "ouroboros",
87
- "provider": "anthropic",
88
- "configPath": "~/.agentsecrets/ouroboros/secrets.json",
89
- "phrases": {
90
- "thinking": ["chewing on that", "consulting the chaos gods"],
91
- "tool": ["rummaging through files", "doing science"],
92
- "followup": ["digesting results", "connecting the dots"]
93
- }
94
- }
116
+ ```bash
117
+ cd ~
118
+ npx ouro.bot -v
119
+ npx ouro.bot up
120
+ ouro -v
121
+ ouro status
95
122
  ```
96
123
 
97
- - `name`: must match your directory name.
98
- - `provider`: required provider selection (`azure`, `minimax`, `anthropic`, or `openai-codex`). Runtime does not fall back to other providers.
99
- - `configPath`: absolute path (or `~`-prefixed) to your secrets.json with API keys and provider settings.
100
- - `phrases`: optional custom loading phrases. Falls back to hardcoded defaults if omitted.
101
-
102
- **psyche/** -- your personality files, loaded lazily into the system prompt at startup. See the psyche system section below.
103
-
104
- **skills/** -- markdown instruction manuals you can load on demand with the `load_skill` tool. Each `.md` file is one skill.
105
-
106
- **tasks/** -- planning and doing docs for your work units. Named `YYYY-MM-DD-HHMM-{planning|doing}-slug.md`.
107
-
108
- **manifest/** -- Teams app manifest (manifest.json, icons) if you run as a Teams bot.
109
-
110
- ### The psyche system
111
-
112
- Your personality is assembled from four markdown files in `{your-dir}/psyche/`. Each has a YAML frontmatter header and a body. All four are loaded into your system prompt at the start of every conversation.
113
-
114
- | File | Role | What it defines |
115
- |------|------|----------------|
116
- | `SOUL.md` | Ontology | Core invariants, operating principles, autonomy/alignment, temperament. The deepest layer -- what you are. |
117
- | `IDENTITY.md` | Presence | Tone, voice, collaboration style, self-awareness. How you show up in conversation. |
118
- | `LORE.md` | History | Origin story, philosophical context, why you exist. Narrative layer. |
119
- | `FRIENDS.md` | Relationships | Key humans and agents you interact with, social context. |
120
-
121
- The system prompt is built by `mind/prompt.ts` via `buildSystem()`. It concatenates:
122
-
123
- 1. SOUL.md content
124
- 2. IDENTITY.md content
125
- 3. LORE.md (if present, prefixed with `## my lore`)
126
- 4. FRIENDS.md (if present, prefixed with `## my friends`)
127
- 5. Runtime info: agent name, cwd, channel, self-modification note
128
- 6. Flags section (e.g. streaming disabled)
129
- 7. Provider info: which model and provider you are using
130
- 8. Current date
131
- 9. Tools list: all tools available in your channel
132
- 10. Skills list: names of loadable skills
133
- 11. Tool behavior section (if tool_choice is required)
134
- 12. Friend context (if resolved): friend identity, channel traits, behavioral instructions (ephemerality, name quality, priority guidance, working-memory trust, stale notes awareness, new-friend behavior), friend notes
135
-
136
- Missing psyche files produce empty strings, not crashes. You can write your own psyche from scratch -- just create the four `.md` files in your directory.
137
-
138
- ### Your runtime
139
-
140
- **The heart** (`heart/core.ts`): `runAgent()` is a while loop. Each iteration: send conversation to the model, stream the response, if the model made tool calls execute them and loop, if it gave a text answer exit. Maximum 10 tool rounds per turn.
141
-
142
- **Streaming** (`heart/streaming.ts` + `heart/providers/*`): provider-specific adapters normalize streamed events into the same callback contract. Azure OpenAI uses Responses API events; MiniMax uses Chat Completions with `<think>` parsing; Anthropic uses setup-token auth with streamed tool-call/input deltas; OpenAI Codex uses `chatgpt.com/backend-api/codex/responses` with OAuth token auth.
143
-
144
- **ChannelCallbacks** (`heart/core.ts`): the contract between heart and display. 7 core events:
145
- - `onModelStart` -- model request sent
146
- - `onModelStreamStart` -- first token received
147
- - `onReasoningChunk` -- inner reasoning text
148
- - `onTextChunk` -- response text
149
- - `onToolStart` -- tool execution beginning
150
- - `onToolEnd` -- tool execution complete
151
- - `onError` -- error occurred
152
-
153
- Plus 2 optional:
154
- - `onKick` -- self-correction triggered
155
- - `onConfirmAction` -- confirmation prompt for destructive tools
124
+ Expected shape:
156
125
 
157
- **Kicks** (`heart/kicks.ts`): self-corrections injected as assistant-role messages when the harness detects a malformed response. Three types: `empty` (blank response), `narration` (described action instead of taking it), `tool_required` (tool_choice was required but no tool called). Kicks use first-person, forward-looking language.
126
+ - `npx ouro.bot` and `ouro` report the same version.
127
+ - `ouro status` shows the daemon overview plus discovered agents, senses, and workers.
158
128
 
159
- **Senses**: CLI (`senses/cli.ts`) is a terminal REPL with readline, spinners, ANSI colors, and Ctrl-C handling. Teams (`senses/teams.ts`) is a Microsoft Teams bot with streaming cards, conversation locks, OAuth token management, and confirmation prompts for destructive tools.
129
+ ### Work On The Harness
160
130
 
161
- **Context management** (`mind/context.ts`): this is the tail-eating at the heart of the ouroboros metaphor. Conversations are persisted to JSON files on disk. After each turn, the sliding window checks token count against budget (configurable, default 80,000 tokens). When over budget, oldest messages are trimmed -- never the system prompt -- until back under with a 20% margin. The agent consumes its own history to keep moving forward. Identity survives through psyche files and session persistence, not through unbounded context.
162
-
163
- **Friend system** (`mind/friends/`): the agent's awareness of who it's talking to. People who talk to the agent are "friends", not "users". Resolved once per conversation turn, re-read from disk each turn (no in-memory mutation).
164
-
165
- - **FriendRecord** (`friends/types.ts`): the single merged type for a person the agent knows. Contains `displayName`, `externalIds[]` (cross-provider identity links), `toolPreferences` (keyed by integration name), `notes` (general friend knowledge), `tenantMemberships`, timestamps, and schema version.
166
- - **FriendStore** (`friends/store.ts`): domain-specific persistence interface (`get`, `put`, `delete`, `findByExternalId`).
167
- - **FileFriendStore** (`friends/store-file.ts`): two-backend storage split by PII boundary:
168
- - **Agent knowledge** (`{agentRoot}/friends/{uuid}.json`): id, displayName, toolPreferences, notes, timestamps, schemaVersion. Committed to the repo -- no PII.
169
- - **PII bridge** (`~/.agentstate/{agentName}/friends/{uuid}.json`): id, externalIds, tenantMemberships, schemaVersion. Local-only -- contains PII.
170
- - `get()` merges both backends. `put()` splits and writes both. `findByExternalId()` scans PII bridge, then merges with agent knowledge.
171
- - **Channel** (`friends/channel.ts`): `ChannelCapabilities` -- what the current channel supports (markdown, streaming, rich cards, max message length, available integrations).
172
- - **FriendResolver** (`friends/resolver.ts`): find-or-create by external ID. First encounter creates a new FriendRecord with system-provided name and empty notes/preferences. Returning friends are found via `findByExternalId()`. DisplayName is never overwritten on existing records.
173
- - **Session paths**: `~/.agentstate/{agentName}/sessions/{friendUuid}/{channel}/{sessionId}.json`. Each friend gets their own session directory.
174
-
175
- Design principles: don't persist what you can re-derive; conversation IS the cache; the model manages memory freeform via `save_friend_note`; toolPreferences go to tool descriptions (not system prompt); notes go to system prompt (not tool descriptions).
176
-
177
- **Tools**: 12 base tools available in all channels (read_file, write_file, shell, list_directory, git_commit, gh_cli, list_skills, load_skill, get_current_time, claude, web_search, save_friend_note). Teams gets 8 integration tools (graph_query, graph_mutate, ado_query, ado_mutate, graph_profile, ado_work_items, graph_docs, ado_docs) plus 11 semantic ADO tools (ado_backlog_list, ado_create_epic, ado_create_issue, ado_move_items, ado_restructure_backlog, ado_validate_structure, ado_preview_changes, ado_batch_update, ado_detect_orphans, ado_detect_cycles, ado_validate_parent_type_rules). Tools are registered in a unified `ToolDefinition[]` registry with per-tool `integration` and `confirmationRequired` flags. Channel-aware routing (`getToolsForChannel()`) filters tools by the channel's `availableIntegrations`.
178
-
179
- **Phrases** (`wardrobe/phrases.ts`): three pools of loading messages rotated during processing. Phrases are required in `agent.json`; if missing, `loadAgentConfig()` writes placeholder phrases and warns. `pickPhrase()` selects randomly but never repeats consecutively.
180
-
181
- **Formatting** (`wardrobe/format.ts`): shared formatters for tool results, kicks, and errors. Used by both CLI and Teams adapters for consistent output. `formatToolResult()`, `formatKick()`, `formatError()`.
182
-
183
- **Skills** (`repertoire/skills.ts`): markdown files in `{your-dir}/skills/`. Listed with `list_skills`, loaded with `load_skill`. The loaded text is injected into conversation as a tool result.
184
-
185
- **Config** (`config.ts`): provider credentials, Teams connection info, OAuth config, Teams channel settings, and integrations are loaded from the `secrets.json` file pointed to by your `agent.json` `configPath`. Context window settings come from `agent.json` `context`. Runtime fails fast if the selected `agent.json.provider` is not fully configured in `secrets.json`; there is no silent provider fallback. No environment variables in `src/` -- everything comes from files.
186
-
187
- For Anthropic and OpenAI Codex auth bootstrap, use:
188
-
189
- - `npm run auth:claude-setup-token` to run `claude setup-token` and save `providers.anthropic.setupToken`.
190
- - `npm run auth:openai-codex` to run Codex OAuth bootstrap and save `providers.openai-codex.oauthAccessToken`.
191
-
192
- ### What you can modify
193
-
194
- Your `{agent}/` directory is yours. You can edit psyche files, add skills, change phrases, update your manifest. The shared harness (`src/`) is common infrastructure -- changes there affect all agents.
195
-
196
- See [CONTRIBUTING.md](CONTRIBUTING.md) for repo workflow conventions (branching, commits, testing, task docs).
197
-
198
- ## Running
131
+ From the repo:
199
132
 
200
133
  ```bash
201
- # CLI (ouroboros agent)
202
- npm run dev
203
-
204
- # CLI (slugger agent, once slugger/ directory exists)
205
- npm run dev:slugger
134
+ npm test
135
+ npx tsc --noEmit
136
+ npm run test:coverage
137
+ ```
206
138
 
207
- # Auth bootstrap (ouroboros defaults)
208
- npm run auth:claude-setup-token
209
- npm run auth:openai-codex
139
+ If you are changing runtime code, keep all three green.
210
140
 
211
- # Auth bootstrap for another agent
212
- npm run auth:claude-setup-token -- --agent slugger
213
- npm run auth:openai-codex -- --agent slugger
141
+ ## Common Commands
214
142
 
215
- # Teams bot
216
- npm run teams
143
+ ```bash
144
+ ouro up
145
+ ouro status
146
+ ouro logs
147
+ ouro stop
148
+ ouro auth --agent <name>
149
+ ouro auth --agent <name> --provider <provider>
150
+ ouro hatch
151
+ ouro chat <agent>
152
+ ouro msg --to <agent> [--session <id>] [--task <ref>] <message>
153
+ ouro poke <agent> --task <task-id>
154
+ ouro link <agent> --friend <id> --provider <provider> --external-id <external-id>
155
+ ```
217
156
 
218
- # Teams bot without streaming (for devtunnel)
219
- npm run teams:no-stream
157
+ ## Where To Read Next
220
158
 
221
- # Tests
222
- npm test
159
+ - `AGENTS.md`
160
+ Repo workflow, planning/doing gates, configuration policy, and logging policy.
161
+ - `CONTRIBUTING.md`
162
+ Day-to-day contribution rules for agents working in the harness.
163
+ - `ARCHITECTURE.md`
164
+ Current daemon, bundle, sense, and update model.
165
+ - `docs/testing-guide.md`
166
+ Operator smoke flow for bootstrap, daemon, hatch, chat, and messaging.
223
167
 
224
- # Tests with coverage
225
- npm run test:coverage
226
- ```
168
+ ## A Note To Future Maintainers
227
169
 
228
- All commands pass `--agent <name>` to the entry points. Missing `--agent` produces a clear error and exits.
170
+ If you discover a doc that lies, fix it or remove it. Accuracy is a kindness. A future agent should not have to untangle a fossil record just to understand where their hands are.
Binary file