@eddacraft/kindling-adapter-opencode
v0.1.2
Published
OpenCode session adapter for Kindling - capture tool calls, commands, and file changes from AI coding sessions
Maintainers
Readme
@eddacraft/kindling-adapter-opencode
OpenCode session adapter for Kindling - capture tool calls, commands, and file changes from AI coding sessions.
Installation
npm install @eddacraft/kindling-adapter-opencodeOverview
Captures observations from OpenCode development sessions for local memory and continuity.
What is Captured
The OpenCode adapter automatically captures the following types of events from your development sessions:
Tool Calls
- Tool name and arguments
- Results or errors
- Duration (execution time)
- Timestamp
Command Execution
- Command text (e.g.,
git status,npm test) - Exit code
- stdout and stderr output
- Working directory
File Changes
- File paths modified
- Diff content (additions/deletions)
- Change summary (lines added/deleted)
Errors
- Error message
- Stack trace preview
- Error source (runtime, validation, etc.)
Messages
- User messages (prompts, questions)
- Assistant messages (responses, explanations)
- Message length and model used
What is NOT Captured
Session lifecycle events (session_start, session_end) are skipped - they are used to manage capsules but not stored as observations.
Safety & Privacy
Automatic Redaction
The adapter automatically detects and redacts sensitive information:
- API keys, tokens, passwords: Patterns like
api_key=,token:,password=are detected and values replaced with[REDACTED] - AWS credentials: AWS secret access keys are masked
- Bearer/Basic auth: Authorization headers are sanitized
- Long secret-like strings: 32+ character alphanumeric strings with mixed letters/numbers are flagged as potential tokens
Excluded Files
The following file paths are automatically excluded from capture:
node_modules/directories.git/directories.envfiles.pem,.keycertificate files- Files containing
credentialsorsecretsin the path
Content Truncation
Large outputs are automatically truncated to 50,000 characters to prevent excessive storage usage. A truncation notice is appended when content is shortened.
Usage
Starting a Session
import { SessionManager } from '@eddacraft/kindling-adapter-opencode';
import { SqliteKindlingStore, initializeDatabase } from '@eddacraft/kindling-store-sqlite';
// Initialize store
const db = initializeDatabase(':memory:');
const store = new SqliteKindlingStore(db);
// Create session manager
const manager = new SessionManager(store);
// Start session
const context = manager.onSessionStart({
sessionId: 'session-123',
intent: 'Fix authentication bug',
repoId: '/home/user/my-project',
});Processing Events
// Process tool call event
manager.onEvent({
type: 'tool_call',
timestamp: Date.now(),
sessionId: 'session-123',
toolName: 'read_file',
args: { path: 'src/auth.ts' },
result: 'file contents...',
});
// Process command event
manager.onEvent({
type: 'command',
timestamp: Date.now(),
sessionId: 'session-123',
command: 'npm test',
exitCode: 0,
stdout: 'All tests passed',
});Ending a Session
// End session with optional summary
manager.onSessionEnd('session-123', {
reason: 'completed',
summaryContent: 'Fixed JWT validation in auth middleware',
summaryConfidence: 0.9,
});Content Filtering
import { filterContent, truncateContent, maskSecrets } from '@eddacraft/kindling-adapter-opencode';
// Apply all safety filters
const filtered = filterContent(content, {
maxLength: 10000,
maskSecrets: true,
showTruncationNotice: true,
});
// Just truncate
const truncated = truncateContent(longContent, { maxLength: 5000 });
// Just mask secrets
const masked = maskSecrets(contentWithSecrets);Configuration
Currently, safety filters are applied by default and cannot be disabled. Future versions may add opt-in/opt-out configuration.
Data Storage
All captured observations are stored locally in SQLite via @eddacraft/kindling-store-sqlite. No data is sent to external services.
Observations are:
- Deterministically ordered by timestamp and sequence number
- Scoped to session, repository, agent, and user
- Queryable via full-text search and filters
- Redactable after capture if needed
Privacy Considerations
What you should know:
- Local only: All data stays on your machine in a local SQLite database
- Automatic sanitization: Sensitive data is detected and redacted automatically
- Manual review: You can inspect and redact observations after capture
- Export/forget: Observations can be exported or permanently deleted
What you should check:
- Review captured observations periodically for accidentally captured secrets
- Use
/memory forget <id>to redact specific observations - Consider excluding sensitive repositories from capture
License
Apache-2.0
