@tpsdev-ai/flair 0.2.0 → 0.3.0

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 CHANGED
@@ -3,11 +3,11 @@
3
3
  [![CI](https://github.com/tpsdev-ai/flair/actions/workflows/test.yml/badge.svg)](https://github.com/tpsdev-ai/flair/actions/workflows/test.yml)
4
4
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
5
5
 
6
- **Identity, memory, and soul for AI agents.**
6
+ **Identity, memory, and soul for AI agents. Runs standalone or as part of a [TPS](https://tps.dev) office.**
7
7
 
8
8
  Agents forget everything between sessions. Flair gives them a persistent sense of self — who they are, what they know, how they think — backed by cryptographic identity and semantic search.
9
9
 
10
- Built on [Harper](https://github.com/HarperFast/harper). Single process. No sidecars. Zero external API calls for embeddings.
10
+ Built on [Harper](https://harper.fast). Single process. No sidecars. Zero external API calls for embeddings.
11
11
 
12
12
  ## Why
13
13
 
@@ -23,7 +23,7 @@ Flair fixes that:
23
23
 
24
24
  ## How It Works
25
25
 
26
- Flair is a native [Harper v5](https://github.com/HarperFast/harper) application. Harper handles HTTP, persistence (RocksDB), and application logic in a single process.
26
+ Flair is a native [Harper v5](https://harper.fast) application. Harper handles HTTP, persistence (RocksDB), and application logic in a single process.
27
27
 
28
28
  ```
29
29
  Agent ──[Ed25519-signed request]──▶ Flair (Harper)
@@ -72,7 +72,7 @@ One Flair instance serves any number of agents. Each agent has its own keys, mem
72
72
  ## Quick Start
73
73
 
74
74
  ### Prerequisites
75
- - [Node.js 20+](https://nodejs.org/) (24+ recommended)
75
+ - [Node.js 22+](https://nodejs.org/)
76
76
 
77
77
  ### Install & Run
78
78
 
@@ -92,53 +92,120 @@ flair status
92
92
 
93
93
  That's it. Your agent now has identity and memory.
94
94
 
95
- ### Use with OpenClaw
95
+ ## Integration
96
+
97
+ Flair works with any agent runtime. Pick the path that fits yours.
98
+
99
+ ### Standalone (Flair CLI)
100
+
101
+ Use the `flair` CLI directly from any agent that can run shell commands.
102
+
103
+ ```bash
104
+ # Write a memory
105
+ flair memory add --agent mybot --content "learned something important"
106
+
107
+ # Search by meaning
108
+ flair memory search --agent mybot --q "that important thing"
109
+
110
+ # Set personality
111
+ flair soul set --agent mybot --key role --value "Security reviewer"
112
+
113
+ # Cold-start bootstrap (soul + recent memories)
114
+ flair bootstrap --agent mybot --max-tokens 4000
115
+
116
+ # Backup / restore
117
+ flair backup --admin-pass "$FLAIR_ADMIN_PASS"
118
+ flair restore ./backup.json --admin-pass "$FLAIR_ADMIN_PASS"
119
+ ```
120
+
121
+ ### OpenClaw
122
+
123
+ One command. Zero config.
96
124
 
97
125
  ```bash
98
- npm install @tpsdev-ai/openclaw-flair
126
+ openclaw plugins install @tpsdev-ai/openclaw-flair
99
127
  ```
100
128
 
101
- Add to your `openclaw.json`:
102
- ```json
103
- {
104
- "memory": {
105
- "provider": "@tpsdev-ai/openclaw-flair"
106
- }
107
- }
129
+ The plugin auto-detects your agent identity, provides `memory_store`/`memory_recall`/`memory_get` tools, and injects relevant memories at session start. See the [plugin README](plugins/openclaw-flair/README.md) for details.
130
+
131
+ ### Claude Code / Codex / Cursor
132
+
133
+ Add a snippet to your `CLAUDE.md` (or `AGENTS.md`, `.codex/instructions.md`, etc.):
134
+
135
+ ```markdown
136
+ ## Memory
137
+
138
+ You have persistent memory via Flair. Use it.
139
+
140
+ ### On session start
141
+ Run: `flair bootstrap --agent mybot --max-tokens 4000`
142
+ This returns your soul + recent memories. Read it — that's your context.
143
+
144
+ ### During work
145
+ - Remember something: `flair memory add --agent mybot --content "what you learned"`
146
+ - Search memory: `flair memory search --agent mybot --q "your query"`
147
+ - Store a lesson: `flair memory add --agent mybot --content "lesson" --type lesson --durability persistent`
148
+
149
+ ### Rules
150
+ - Bootstrap FIRST, before doing anything else
151
+ - Store lessons and decisions immediately — don't wait
152
+ - If you learn something that should survive restarts, write it to Flair
108
153
  ```
109
154
 
110
- Your agent will automatically remember things between sessions and recall them by meaning.
155
+ ### JavaScript / TypeScript (Client Library)
111
156
 
112
- ### Use the CLI directly
157
+ For custom integrations, use the lightweight client — no Harper, no embeddings, just HTTP + auth:
113
158
 
114
159
  ```bash
115
- # Write a memory
116
- flair memory add --agent mybot --content "Harper v5 sandbox blocks bare imports"
160
+ npm install @tpsdev-ai/flair-client
161
+ ```
117
162
 
118
- # Search by meaning, not keywords
119
- flair memory search --agent mybot --q "native module loading issues"
163
+ ```typescript
164
+ import { FlairClient } from '@tpsdev-ai/flair-client'
120
165
 
121
- # Set personality
122
- flair soul set --agent mybot --key role --value "Security reviewer, meticulous and skeptical"
166
+ const flair = new FlairClient({
167
+ url: 'http://localhost:9926', // or remote: https://flair.example.com
168
+ agentId: 'mybot',
169
+ // key auto-resolved from ~/.flair/keys/mybot.key
170
+ })
123
171
 
124
- # Back up everything
125
- flair backup --admin-pass "$FLAIR_ADMIN_PASS"
172
+ // Write a memory
173
+ await flair.memory.write('Harper v5 sandbox blocks bare imports')
174
+
175
+ // Search by meaning
176
+ const results = await flair.memory.search('native module loading')
177
+
178
+ // Cold-start bootstrap
179
+ const ctx = await flair.bootstrap({ maxTokens: 4000 })
126
180
 
127
- # Restore from backup
128
- flair restore ./flair-backup-2026-03-15.json --admin-pass "$FLAIR_ADMIN_PASS"
181
+ // Set personality
182
+ await flair.soul.set('role', 'Security reviewer')
129
183
  ```
130
184
 
131
- ### Cold Start Bootstrap
185
+ See the [client README](packages/flair-client/README.md) for the full API.
132
186
 
133
- Agents can pull their full context on startup via the `BootstrapMemories` endpoint:
187
+ ### HTTP API (Any Language)
188
+
189
+ Flair is a pure HTTP API. Use it from Python, Go, Rust, shell scripts — anything that can make HTTP requests and sign with Ed25519.
134
190
 
135
191
  ```bash
136
- curl -H "Authorization: TPS-Ed25519 ..." \
192
+ # Search memories
193
+ curl -H "Authorization: TPS-Ed25519 mybot:$TS:$NONCE:$SIG" \
194
+ -X POST http://localhost:9926/SemanticSearch \
195
+ -d '{"agentId": "mybot", "q": "deployment procedure", "limit": 5}'
196
+
197
+ # Write a memory
198
+ curl -H "Authorization: TPS-Ed25519 mybot:$TS:$NONCE:$SIG" \
199
+ -X PUT http://localhost:9926/Memory/mybot-123 \
200
+ -d '{"id": "mybot-123", "agentId": "mybot", "content": "...", "durability": "standard"}'
201
+
202
+ # Bootstrap (soul + recent memories)
203
+ curl -H "Authorization: TPS-Ed25519 mybot:$TS:$NONCE:$SIG" \
137
204
  -X POST http://localhost:9926/BootstrapMemories \
138
205
  -d '{"agentId": "mybot", "maxTokens": 4000}'
139
206
  ```
140
207
 
141
- Returns soul + recent memories + relevant context as a formatted block. Bounded context regardless of total memory size.
208
+ Auth is Ed25519 sign `agentId:timestamp:nonce:METHOD:/path` with your private key. See [SECURITY.md](SECURITY.md) for the full protocol.
142
209
 
143
210
  ## Architecture
144
211
 
@@ -154,11 +221,11 @@ flair/
154
221
  │ ├── embeddings-provider.ts # In-process nomic embeddings
155
222
  │ ├── Memory.ts # Durability enforcement + auto-embed
156
223
  │ ├── Soul.ts # Permanent-by-default personality
157
- │ ├── MemorySearch.ts # Hybrid semantic + keyword search
224
+ │ ├── SemanticSearch.ts # Hybrid semantic + keyword search
158
225
  │ ├── MemoryBootstrap.ts # Cold start context assembly
159
226
  │ └── MemoryFeed.ts # Real-time memory changes
160
227
  ├── plugins/
161
- │ └── openclaw-memory/ # @tpsdev-ai/openclaw-flair plugin
228
+ │ └── openclaw-flair/ # @tpsdev-ai/openclaw-flair plugin
162
229
  └── SECURITY.md # Threat model + auth documentation
163
230
  ```
164
231
 
@@ -219,9 +286,9 @@ Integration tests spin up a real Harper instance on a random port, run the test
219
286
 
220
287
  ## Status
221
288
 
222
- > **Note:** Flair uses [Harper v5](https://github.com/HarperFast/harper), currently in beta. We run it in production daily and track upstream closely. Pin your Harper version.
289
+ > **Note:** Flair uses [Harper v5](https://harper.fast), currently in beta. We run it in production daily and track upstream closely. Pin your Harper version.
223
290
 
224
- Flair is in active development and daily use. We dogfood it — the agents that build Flair use Flair for their own memory and identity. 7 agents, 150+ memories, running continuously since March 2026.
291
+ Flair is in active development and daily use. We dogfood it — the agents that build Flair use Flair for their own memory and identity.
225
292
 
226
293
  **What works:**
227
294
  - ✅ Ed25519 agent identity and auth