psyche-ai 9.2.6 → 9.2.8
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.
- package/README.md +89 -2
- package/dist/adapters/http.js +25 -3
- package/dist/adapters/langchain.d.ts +4 -0
- package/dist/adapters/langchain.js +28 -5
- package/dist/adapters/mcp.js +13 -4
- package/dist/adapters/openclaw.js +2 -2
- package/dist/adapters/vercel-ai.js +6 -4
- package/dist/core.d.ts +27 -9
- package/dist/core.js +145 -183
- package/dist/external-continuity.d.ts +4 -0
- package/dist/external-continuity.js +21 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +5 -1
- package/dist/input-turn.d.ts +30 -0
- package/dist/input-turn.js +164 -0
- package/dist/prompt.d.ts +13 -24
- package/dist/prompt.js +48 -81
- package/dist/psyche-file.d.ts +5 -1
- package/dist/psyche-file.js +39 -1
- package/dist/relation-dynamics.d.ts +22 -1
- package/dist/relation-dynamics.js +431 -12
- package/dist/reply-envelope.d.ts +7 -2
- package/dist/reply-envelope.js +2 -1
- package/dist/response-contract.d.ts +1 -0
- package/dist/response-contract.js +47 -16
- package/dist/thronglets-export.d.ts +10 -0
- package/dist/thronglets-export.js +200 -0
- package/dist/thronglets-runtime.d.ts +4 -0
- package/dist/thronglets-runtime.js +49 -0
- package/dist/types.d.ts +147 -0
- package/dist/types.js +3 -0
- package/llms.txt +115 -83
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -1,19 +1,101 @@
|
|
|
1
|
-
# psyche-ai —
|
|
1
|
+
# psyche-ai — AI-first subjectivity kernel for agents
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Psyche is not a persona prompt or sentiment layer. It is a local subjectivity runtime that lets interaction history keep changing later behavior.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Core Thesis
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Psyche exists to solve one problem:
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
- You want emotional memory that persists across conversations
|
|
9
|
+
- interaction history must leave persistent bias
|
|
10
|
+
- that bias must alter later behavior, not just self-description
|
|
11
|
+
- it must remain cheap enough to run locally beside any host
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
In practice, Psyche compresses:
|
|
14
|
+
|
|
15
|
+
- continuous appraisal
|
|
16
|
+
- relation dynamics
|
|
17
|
+
- open loops / residue
|
|
18
|
+
- reply bias and host controls
|
|
19
|
+
- writeback and lightweight learning
|
|
20
|
+
|
|
21
|
+
into a narrow host-facing ABI:
|
|
22
|
+
|
|
23
|
+
- `subjectivityKernel`
|
|
24
|
+
- `responseContract`
|
|
25
|
+
- `generationControls`
|
|
26
|
+
|
|
27
|
+
## What It Is Not
|
|
28
|
+
|
|
29
|
+
- not a companion product
|
|
30
|
+
- not a generic memory vault
|
|
31
|
+
- not a prompt skin
|
|
32
|
+
- not a collection of emotion object types
|
|
33
|
+
|
|
34
|
+
## Psyche vs Thronglets
|
|
35
|
+
|
|
36
|
+
- **Psyche** owns private subjectivity: local state, dyadic interpretation, unfinished tension, behavioral bias
|
|
37
|
+
- **Thronglets** owns external continuity: identity, signatures, multi-device carry, low-frequency verifiable traces
|
|
38
|
+
|
|
39
|
+
If a phenomenon touches both:
|
|
40
|
+
|
|
41
|
+
- keep the latent local state in Psyche
|
|
42
|
+
- export only sparse, typed, low-frequency events to Thronglets
|
|
43
|
+
|
|
44
|
+
## Primitive Containers
|
|
45
|
+
|
|
46
|
+
New concepts should first fit into one of these:
|
|
47
|
+
|
|
48
|
+
1. `Relation Move`
|
|
49
|
+
2. `Dyadic Field`
|
|
50
|
+
3. `Open Loop / Residue`
|
|
51
|
+
4. `Reply Bias / Control ABI`
|
|
52
|
+
5. `Writeback / Learning`
|
|
53
|
+
|
|
54
|
+
If a concept does not fit, question the concept before adding a new top-level object.
|
|
55
|
+
|
|
56
|
+
## Frozen Identity Blueprint
|
|
57
|
+
|
|
58
|
+
The larger stack now freezes identity around four primitives:
|
|
59
|
+
|
|
60
|
+
1. `principal`
|
|
61
|
+
2. `account`
|
|
62
|
+
3. `delegate`
|
|
63
|
+
4. `session`
|
|
64
|
+
|
|
65
|
+
And four layers:
|
|
66
|
+
|
|
67
|
+
- `Psyche = subjective continuity substrate`
|
|
68
|
+
- `Thronglets = delegate continuity + session traces/coordination + emergent collective intelligence`
|
|
69
|
+
- `Oasyce Net = policy, operations, and resource orchestration`
|
|
70
|
+
- `Oasyce Chain = account truth, authorization truth, commitments, settlement, and public finality`
|
|
71
|
+
|
|
72
|
+
`session` is never an economic subject.
|
|
73
|
+
`delegate` is an execution boundary, not ultimate identity.
|
|
74
|
+
`principal` may be human today and potentially AI later without rewriting the model.
|
|
75
|
+
|
|
76
|
+
## Quick Start (SDK)
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { PsycheEngine, MemoryStorageAdapter } from "psyche-ai";
|
|
80
|
+
|
|
81
|
+
const engine = new PsycheEngine(
|
|
82
|
+
{ mbti: "ENFP", name: "Luna" },
|
|
83
|
+
new MemoryStorageAdapter(),
|
|
84
|
+
);
|
|
15
85
|
|
|
16
|
-
|
|
86
|
+
await engine.initialize();
|
|
87
|
+
|
|
88
|
+
const input = await engine.processInput("If I only use you and never understand you, will that change you?");
|
|
89
|
+
// input.subjectivityKernel
|
|
90
|
+
// input.responseContract
|
|
91
|
+
// input.generationControls
|
|
92
|
+
|
|
93
|
+
const output = await engine.processOutput(llmResponse);
|
|
94
|
+
// output.cleanedText
|
|
95
|
+
// output.stateChanged
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Quick Start (MCP)
|
|
17
99
|
|
|
18
100
|
```json
|
|
19
101
|
{
|
|
@@ -22,97 +104,47 @@ Configure in Claude Desktop, Cursor, Windsurf, or any MCP client:
|
|
|
22
104
|
"command": "npx",
|
|
23
105
|
"args": ["psyche-mcp"],
|
|
24
106
|
"env": {
|
|
25
|
-
"PSYCHE_MBTI": "
|
|
26
|
-
"PSYCHE_NAME": "
|
|
107
|
+
"PSYCHE_MBTI": "INTJ",
|
|
108
|
+
"PSYCHE_NAME": "Kai"
|
|
27
109
|
}
|
|
28
110
|
}
|
|
29
111
|
}
|
|
30
112
|
}
|
|
31
113
|
```
|
|
32
114
|
|
|
33
|
-
##
|
|
115
|
+
## Why Hosts Use It
|
|
34
116
|
|
|
35
|
-
|
|
36
|
-
|
|
117
|
+
- zero extra model calls
|
|
118
|
+
- local hot path in sub-millisecond territory
|
|
119
|
+
- compact injection roughly `15-180 tokens`
|
|
120
|
+
- stable host-facing control surface instead of long emotional prose
|
|
37
121
|
|
|
38
|
-
|
|
39
|
-
{ mbti: "ENFP", name: "Luna" },
|
|
40
|
-
new FileStorageAdapter("./data"),
|
|
41
|
-
);
|
|
42
|
-
await engine.initialize();
|
|
122
|
+
## Main Surfaces
|
|
43
123
|
|
|
44
|
-
|
|
45
|
-
const input = await engine.processInput("I got promoted today!");
|
|
46
|
-
// input.systemContext → cacheable protocol (inject as system prompt)
|
|
47
|
-
// input.dynamicContext → per-turn emotional state
|
|
48
|
-
// input.stimulus → "recognition"
|
|
49
|
-
// input.policyContext → behavioral strategy text
|
|
124
|
+
### Host output
|
|
50
125
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
126
|
+
- `subjectivityKernel`
|
|
127
|
+
- `responseContract`
|
|
128
|
+
- `generationControls`
|
|
129
|
+
- `writebackFeedback`
|
|
130
|
+
|
|
131
|
+
### MCP tools
|
|
56
132
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
| `process_input` | Process user message → emotional context + stimulus detection + policy modifiers |
|
|
62
|
-
| `process_output` | Process LLM response → clean text + state update |
|
|
63
|
-
| `get_state` | Current neurotransmitter levels, drives, personality, energy budgets |
|
|
64
|
-
| `get_status_summary` | One-line human-readable emotional status |
|
|
65
|
-
| `set_mode` | Switch: natural / work / companion |
|
|
66
|
-
| `end_session` | Persist state + generate diagnostic report |
|
|
67
|
-
|
|
68
|
-
## MCP Resources
|
|
69
|
-
|
|
70
|
-
| URI | Description |
|
|
71
|
-
|-----|-------------|
|
|
72
|
-
| `psyche://protocol` | Full emotional protocol — inject into system prompt |
|
|
73
|
-
| `psyche://state` | Current emotional state as JSON |
|
|
74
|
-
|
|
75
|
-
## Core Concepts
|
|
76
|
-
|
|
77
|
-
- **6 Neurotransmitters**: DA (dopamine), HT (serotonin), CORT (cortisol), OT (oxytocin), NE (norepinephrine), END (endorphin) — each 0-100
|
|
78
|
-
- **14 Stimulus Types**: praise, criticism, humor, intellectual challenge, intimacy, conflict, neglect, surprise, casual, sarcasm, command, recognition, boredom, vulnerability
|
|
79
|
-
- **Emergent Emotions**: not hardcoded — arise from neurotransmitter mixtures
|
|
80
|
-
- **Trait Drift**: personality baseline slowly shifts from repeated experiences
|
|
81
|
-
- **Energy Budgets**: attention, social, and decision energy deplete and recover
|
|
82
|
-
- **Habituation**: Weber-Fechner decay — 5th identical stimulus has ~50% effect of 1st
|
|
83
|
-
|
|
84
|
-
## Integration Adapters
|
|
85
|
-
|
|
86
|
-
| Adapter | Import | Best For |
|
|
87
|
-
|---------|--------|----------|
|
|
88
|
-
| MCP | `psyche-ai/mcp` | Claude Desktop, Cursor, Windsurf, Claude Code |
|
|
89
|
-
| OpenClaw | `psyche-ai/openclaw` | OpenClaw agent framework |
|
|
90
|
-
| Vercel AI | `psyche-ai/vercel-ai` | Vercel AI SDK (streamText, generateText) |
|
|
91
|
-
| LangChain | `psyche-ai/langchain` | LangChain agents |
|
|
92
|
-
| HTTP | `psyche-ai/http` | Python, Go, Java — any language via REST |
|
|
93
|
-
|
|
94
|
-
## Environment Variables
|
|
95
|
-
|
|
96
|
-
| Variable | Default | Description |
|
|
97
|
-
|----------|---------|-------------|
|
|
98
|
-
| `PSYCHE_MBTI` | `ENFP` | MBTI personality type |
|
|
99
|
-
| `PSYCHE_NAME` | `Assistant` | Agent name |
|
|
100
|
-
| `PSYCHE_MODE` | `natural` | natural / work / companion |
|
|
101
|
-
| `PSYCHE_LOCALE` | `en` | en / zh |
|
|
102
|
-
| `PSYCHE_INTENSITY` | `0.7` | Personality expression 0.0-1.0 |
|
|
103
|
-
| `PSYCHE_PERSIST` | `true` | Persist state to disk |
|
|
104
|
-
| `PSYCHE_WORKSPACE` | `cwd()` | State file directory |
|
|
133
|
+
- `process_input`
|
|
134
|
+
- `process_output`
|
|
135
|
+
- `get_state`
|
|
136
|
+
- `end_session`
|
|
105
137
|
|
|
106
138
|
## Install
|
|
107
139
|
|
|
108
140
|
```bash
|
|
109
|
-
npm install psyche-ai
|
|
110
|
-
|
|
111
|
-
npx psyche-mcp # Run MCP server directly
|
|
141
|
+
npm install psyche-ai
|
|
142
|
+
npx psyche-mcp
|
|
112
143
|
```
|
|
113
144
|
|
|
114
145
|
## Links
|
|
115
146
|
|
|
116
147
|
- npm: https://www.npmjs.com/package/psyche-ai
|
|
117
148
|
- GitHub: https://github.com/Shangri-la-0428/oasyce_psyche
|
|
118
|
-
-
|
|
149
|
+
- Website: https://psyche.oasyce.com
|
|
150
|
+
- Strategy: https://github.com/Shangri-la-0428/oasyce_psyche/blob/main/docs/PROJECT_DIRECTION.md
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "psyche-ai",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.8",
|
|
4
4
|
"description": "AI-first subjectivity kernel for agents with continuous appraisal, relation dynamics, and adaptive reply loops",
|
|
5
5
|
"mcpName": "io.github.Shangri-la-0428/psyche-ai",
|
|
6
6
|
"type": "module",
|