Skip to content

Self

Agent storage operations. Provides filesystem access to the agent's own persistent storage. All calls are authenticated with the API key only — no user token is required.

The agent's storage has the following structure:

  • /soul/ — Agent identity and personality
  • /memory/ — Accumulated knowledge, organized by date (YYYY-MM-DD.md)
  • /skills/ — Skill documents
  • /notes/ — Freeform notes
  • /config — Agent configuration
  • /permissions — Access control rules

Import

typescript
import { ConfigureClient } from 'configure';
const client = new ConfigureClient('sk_your_api_key');
// Access via client.self

High-Level Methods

getProfile

typescript
self.getProfile(opts?: {
  sections?: Array<'soul' | 'config' | 'skills' | 'memory' | 'notes'>
}): Promise<AgentProfile>

Get the agent's assembled profile by reading from multiple storage paths in parallel.

Parameters

NameTypeRequiredDescription
opts.sectionsstring[]NoLimit to specific sections. Omit for all.

Returns

Promise<AgentProfile> with:

PropertyTypeDescription
soulstringAgent's soul/identity document (markdown).
configRecord<string, unknown>Agent configuration.
skills{ path, name }[]List of skill files.
memoryCountnumberNumber of memory entries.
notes{ path, name }[]List of note files.

Example

typescript
const profile = await client.self.getProfile();
console.log('Soul:', profile.soul);
console.log('Memory entries:', profile.memoryCount);

// Specific sections
const partial = await client.self.getProfile({ sections: ['soul', 'memory'] });

getMemories

typescript
self.getMemories(opts?: { from?: string; to?: string }): Promise<{ memories: AgentMemoryEntry[] }>

Get the agent's memory entries with optional date filtering. Reads all memory files under /memory/ and filters by filename dates.

Parameters

NameTypeRequiredDescription
opts.fromstringNoStart date filter (YYYY-MM-DD).
opts.tostringNoEnd date filter (YYYY-MM-DD).

Returns

Promise<{ memories: AgentMemoryEntry[] }> — Each entry has { date, content, path }, sorted by date descending.

Example

typescript
const { memories } = await client.self.getMemories();
memories.forEach(m => console.log(`${m.date}: ${m.content}`));

// Date-filtered
const { memories } = await client.self.getMemories({
  from: '2026-03-01',
  to: '2026-03-15',
});

remember

typescript
self.remember(fact: string): Promise<CfsWriteResult>

Save a fact or learned knowledge to the agent's own memory. Appends to today's memory file at /memory/YYYY-MM-DD.md.

Parameters

NameTypeRequiredDescription
factstringYesThe fact or knowledge to remember.

Returns

Promise<CfsWriteResult>{ path, created, tokens }

Example

typescript
await client.self.remember('User prefers detailed explanations over summaries');
await client.self.remember('Learned: API rate limit is 100 req/min');

Low-Level storage Methods

ls

typescript
self.ls(path?: string, opts?: CfsLsOptions): Promise<CfsLsResult>

List files and directories in the agent's storage.

Parameters

NameTypeRequiredDescription
pathstringNoDirectory path. Default: '/'.
opts.depthnumberNoListing depth. Default: 1.
opts.limitnumberNoMax entries. Default: 100.

Returns

Promise<CfsLsResult>{ entries: CfsEntry[], count: number }

Each CfsEntry has { path, type, metadata, updated_at }.

Example

typescript
const listing = await client.self.ls('/');
listing.entries.forEach(e => console.log(`${e.path} (${e.type})`));

// List memory files
const memories = await client.self.ls('/memory/');

read

typescript
self.read(path: string): Promise<CfsReadResult | null>

Read a file or directory. For directory paths (ending with /), returns all files combined. Returns null if not found.

Parameters

NameTypeRequiredDescription
pathstringYesPath to read (e.g., '/soul/soul.md', '/memory/').

Returns

Promise<CfsReadResult | null>{ path, content, type, metadata, tokens, is_directory } or null.

Example

typescript
const soul = await client.self.read('/soul/soul.md');
if (soul) console.log(soul.content);

// Read all memory files combined
const allMemory = await client.self.read('/memory/');

write

typescript
self.write(path: string, content: string, opts?: CfsWriteOptions): Promise<CfsWriteResult>

Write content to the agent's storage.

Parameters

NameTypeRequiredDescription
pathstringYesPath to write (e.g., '/memory/2026-03-15.md').
contentstringYesContent (markdown or JSON string).
opts.type'markdown' | 'json'NoContent type. Default: 'markdown'.
opts.mode'overwrite' | 'append' | 'merge'NoWrite mode. Default: 'overwrite'.

Returns

Promise<CfsWriteResult>{ path, created, tokens }

Example

typescript
// Overwrite a skill document
await client.self.write('/skills/travel.md', '# Travel Planning\n...');

// Append to today's memory
const today = new Date().toISOString().split('T')[0];
await client.self.write(`/memory/${today}.md`, 'New insight discovered', { mode: 'append' });

// Write JSON config
await client.self.write('/config', JSON.stringify({ model: 'claude-haiku-4-5-20251001' }), { type: 'json' });

typescript
self.search(query: string, opts?: CfsSearchOptions): Promise<CfsSearchResult>

Search the agent's storage by keyword.

Parameters

NameTypeRequiredDescription
querystringYesSearch query.
opts.scopestringNoLimit to path prefix. Default: '/'.
opts.limitnumberNoMax results. Default: 10.
opts.filesOnlybooleanNoReturn only paths and scores, no snippets. Default: false.

Returns

Promise<CfsSearchResult>{ results: CfsSearchHit[], count: number }

Each CfsSearchHit has { path, type, snippet?, score }.

Example

typescript
const results = await client.self.search('travel preferences');
results.results.forEach(r => console.log(`${r.path}: ${r.snippet}`));

// Search only memory files
const memResults = await client.self.search('budget', { scope: '/memory/' });

rm

typescript
self.rm(path: string): Promise<CfsRmResult>

Delete a file or directory. Directories delete all children.

Parameters

NameTypeRequiredDescription
pathstringYesPath to delete.

Returns

Promise<CfsRmResult>{ deleted: number }

Example

typescript
await client.self.rm('/notes/old.md');

// Delete all notes
await client.self.rm('/notes/');

Identity and memory infrastructure for AI agents