flint-agent 1.14.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/.env.example +108 -0
- package/CHANGELOG.md +55 -0
- package/FEATURES.md +298 -0
- package/LICENSE +21 -0
- package/README.md +435 -0
- package/bin/flint.js +47 -0
- package/config/classifier-prompt.md +218 -0
- package/config/models-curated.json +4 -0
- package/config/providers.json +74 -0
- package/package.json +92 -0
- package/patches/ink+6.8.0.patch +78 -0
- package/profiles/desktop.md +65 -0
- package/profiles/generic.md +20 -0
- package/profiles/marketer.md +20 -0
- package/profiles/profiles.json +34 -0
- package/profiles/ux-reviewer.md +25 -0
- package/src/agent/agent.js +1743 -0
- package/src/agent/auto.js +346 -0
- package/src/agent/backoff.js +143 -0
- package/src/agent/compression.js +310 -0
- package/src/agent/content-resolver.js +180 -0
- package/src/agent/flow-controller.js +309 -0
- package/src/agent/intent-manifest.js +231 -0
- package/src/agent/intent-timeout.js +46 -0
- package/src/agent/intent.js +633 -0
- package/src/agent/knowledge.js +114 -0
- package/src/agent/learning.js +180 -0
- package/src/agent/modes.js +187 -0
- package/src/agent/outcome-ask.js +91 -0
- package/src/agent/project-context.js +76 -0
- package/src/agent/prompt-budget.js +117 -0
- package/src/agent/reflection-extractor.js +140 -0
- package/src/agent/steering.js +86 -0
- package/src/agent/supervisor.js +430 -0
- package/src/agent/swap.js +443 -0
- package/src/agent/system-prompt.js +446 -0
- package/src/agent/time-stamp.js +48 -0
- package/src/agent/tool-guard.js +201 -0
- package/src/agent/toolcall-text.js +162 -0
- package/src/agent/usage.js +297 -0
- package/src/agent/vision.js +94 -0
- package/src/agent/watchdog.js +139 -0
- package/src/agent/workspace-changes.js +177 -0
- package/src/api/address.js +14 -0
- package/src/api/client.js +280 -0
- package/src/api/server.js +535 -0
- package/src/api/stream-pipe.js +113 -0
- package/src/app-state.js +39 -0
- package/src/bootstrap.js +501 -0
- package/src/bus/drain-loop.js +497 -0
- package/src/bus/index.js +270 -0
- package/src/bus/plugins.js +65 -0
- package/src/child-idle.js +14 -0
- package/src/cli.js +118 -0
- package/src/commands/commands.js +1297 -0
- package/src/commands/registry.js +132 -0
- package/src/components/App.js +491 -0
- package/src/components/CarefulMenu.js +145 -0
- package/src/components/HistoryWriter.js +86 -0
- package/src/components/LineInput.js +69 -0
- package/src/components/LiveZone.js +294 -0
- package/src/components/OverlayMenu.js +179 -0
- package/src/components/SystemPanel.js +156 -0
- package/src/components/Table.js +54 -0
- package/src/config.js +249 -0
- package/src/free-models.js +230 -0
- package/src/index.js +1111 -0
- package/src/input-handler.js +13 -0
- package/src/input-text.js +123 -0
- package/src/launcher.js +129 -0
- package/src/logging/api-log.js +95 -0
- package/src/logging/chat-log-follower.js +113 -0
- package/src/logging/chat-log.js +15 -0
- package/src/logging/log-collector.js +182 -0
- package/src/logging/logger.js +112 -0
- package/src/logging/tool-log.js +20 -0
- package/src/mcp-client.js +314 -0
- package/src/memory/conversation-digest.js +113 -0
- package/src/memory/extract-facts.js +98 -0
- package/src/memory/facts.js +181 -0
- package/src/memory/inbox.js +63 -0
- package/src/memory/markdown.js +38 -0
- package/src/memory/patterns.js +185 -0
- package/src/memory/project.js +66 -0
- package/src/memory/reflections.js +74 -0
- package/src/memory/retrieval.js +84 -0
- package/src/memory/rules.js +105 -0
- package/src/memory/session-facts.js +125 -0
- package/src/memory/skills.js +191 -0
- package/src/memory/sqlite-store.js +653 -0
- package/src/memory/store.js +208 -0
- package/src/memory/tools.js +196 -0
- package/src/memory/user-model.js +86 -0
- package/src/message-handler.js +775 -0
- package/src/model-check.js +218 -0
- package/src/plugins/loader.js +120 -0
- package/src/plugins/manager.js +88 -0
- package/src/production-env.js +22 -0
- package/src/profiles.js +42 -0
- package/src/providers/adapters/anthropic.js +270 -0
- package/src/providers/adapters/openai.js +120 -0
- package/src/providers/keys-dpapi.js +41 -0
- package/src/providers/keys-fallback.js +31 -0
- package/src/providers/keys.js +132 -0
- package/src/providers/models.js +154 -0
- package/src/providers/registry.js +56 -0
- package/src/providers/state.js +56 -0
- package/src/registry.js +96 -0
- package/src/restart.js +29 -0
- package/src/sandbox/backend.js +130 -0
- package/src/security/api-auth.js +132 -0
- package/src/security/audit.js +98 -0
- package/src/security/child-policy.js +41 -0
- package/src/security/command-guard.js +173 -0
- package/src/security/content-fence.js +250 -0
- package/src/security/content-validator.js +132 -0
- package/src/security/index.js +143 -0
- package/src/security/network-guard.js +126 -0
- package/src/security/pairing.js +180 -0
- package/src/security/path-guard.js +140 -0
- package/src/security/persona-guard.js +67 -0
- package/src/security/policies.js +452 -0
- package/src/security/safety-constants.js +34 -0
- package/src/security/watchdog.js +107 -0
- package/src/sessions.js +130 -0
- package/src/spend.js +97 -0
- package/src/startup-watchdog.js +59 -0
- package/src/stdio/args.js +71 -0
- package/src/stdio/guard.js +59 -0
- package/src/stdio/protocol.js +167 -0
- package/src/stdio/run.js +106 -0
- package/src/stdio/session.js +180 -0
- package/src/store/agent-slice.js +306 -0
- package/src/store/dataset-slice.js +73 -0
- package/src/store/index.js +22 -0
- package/src/store/process-slice.js +135 -0
- package/src/store/session-slice.js +191 -0
- package/src/store/ui-slice.js +119 -0
- package/src/tasks/db.js +184 -0
- package/src/tasks/queries.js +589 -0
- package/src/tools/agent-tools.js +473 -0
- package/src/tools/checkpoint.js +152 -0
- package/src/tools/command-approvals.js +180 -0
- package/src/tools/dataset.js +50 -0
- package/src/tools/filesystem.js +682 -0
- package/src/tools/inbox-tools.js +48 -0
- package/src/tools/mesh.js +135 -0
- package/src/tools/own-env.js +136 -0
- package/src/tools/permissions.js +681 -0
- package/src/tools/plugin-tools.js +123 -0
- package/src/tools/process-tools.js +595 -0
- package/src/tools/registry.js +307 -0
- package/src/tools/swap-tools.js +72 -0
- package/src/tools/system.js +662 -0
- package/src/tools/tasks.js +532 -0
- package/src/tools/tool-search.js +171 -0
- package/src/ui/header.js +140 -0
- package/src/ui/input-cursor.js +23 -0
- package/src/ui/last-line.js +25 -0
- package/src/ui/line-edit.js +135 -0
- package/src/ui/output.js +399 -0
- package/src/ui/paste-tokens.js +131 -0
- package/src/ui/prompt-attention.js +134 -0
- package/src/ui/render-options.js +13 -0
- package/src/ui/replay.js +94 -0
- package/src/ui/splash.js +49 -0
- package/src/ui/status-level.js +36 -0
- package/src/ui/tool-ledger.js +203 -0
- package/src/ui/window-title.js +150 -0
- package/src/update.js +205 -0
- package/system.md +63 -0
package/.env.example
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Flint Agent — Environment Variables
|
|
2
|
+
# Copy to .env and fill in your values
|
|
3
|
+
|
|
4
|
+
# Provider API keys (at least one required)
|
|
5
|
+
OPENROUTER_API_KEY=
|
|
6
|
+
# OPENAI_API_KEY=
|
|
7
|
+
# ANTHROPIC_API_KEY=
|
|
8
|
+
|
|
9
|
+
# Provider and model (optional — set via first-run wizard or /model command)
|
|
10
|
+
# FLINT_PROVIDER=openrouter
|
|
11
|
+
# OPENROUTER_MODEL=google/gemini-2.5-flash
|
|
12
|
+
# OpenRouter hosts for the main model (provider slugs from the model's endpoints
|
|
13
|
+
# page). Unset = OpenRouter picks, and hosts differ in price and in answers.
|
|
14
|
+
# OPENROUTER_PROVIDER_ONLY=xiaomi,atlas-cloud
|
|
15
|
+
# OPENROUTER_PROVIDER_IGNORE=digitalocean
|
|
16
|
+
# OPENROUTER_PROVIDER_ORDER=
|
|
17
|
+
# OPENROUTER_PROVIDER_SORT=price # price | throughput | latency
|
|
18
|
+
|
|
19
|
+
# Classifier model — REQUIRED, no fallback. Runs before every user turn
|
|
20
|
+
# and picks the tools the agent sees. Measured 2026-04-21 on 4 MCP-routing
|
|
21
|
+
# tasks (docs / planner / mesh / browser):
|
|
22
|
+
# openai/gpt-5.4-mini 4/4 1.5-2s $0.75/M best value, recommended
|
|
23
|
+
# x-ai/grok-4.20 4/4 1.0-1.3s $2/M fastest
|
|
24
|
+
# anthropic/claude-sonnet-4.6 4/4 2.5-3s $3/M also works
|
|
25
|
+
# qwen/qwen3.5-flash-02-23 4/4 4-15s $0.07/M cheapest but too slow for classifier
|
|
26
|
+
# Known-bad:
|
|
27
|
+
# openai/gpt-5.4-nano 1/4 — picks "no tools" when tools ARE needed
|
|
28
|
+
# google/gemini-2.0-flash-001 2.5/4 — prev default, misses MCP routing
|
|
29
|
+
# nvidia/nemotron-3-super 0/4 — returns plain text instead of JSON
|
|
30
|
+
INTENT_MODEL=openai/gpt-5.4-mini
|
|
31
|
+
|
|
32
|
+
# Agent limits
|
|
33
|
+
# AGENT_MAX_ITERATIONS=150 # Max tool-call iterations per message
|
|
34
|
+
# AGENT_MAX_COST=0 # Max cost per message ($, 0=unlimited)
|
|
35
|
+
# AGENT_AUTO_MAX_ITERATIONS=50 # Max iterations in /auto mode
|
|
36
|
+
# AGENT_AUTO_MAX_COST=0.50 # Max cost in /auto mode ($)
|
|
37
|
+
# AGENT_MAX_RESPONSE_TOKENS=16384 # Max response tokens per API call
|
|
38
|
+
# AGENT_MAX_RESPONSE_LINES=500 # Max lines per response
|
|
39
|
+
# AGENT_MAX_CHILDREN=5 # Max concurrent child agents
|
|
40
|
+
# AGENT_MAX_BATCH_FILES=20 # Max files per batch operation
|
|
41
|
+
# AGENT_MAX_LINES=5000 # Max lines per file read
|
|
42
|
+
|
|
43
|
+
# Filesystem sandbox
|
|
44
|
+
# AGENT_ALLOWED_PATHS=/home/user/project,/tmp # Comma-separated allowed dirs (empty=unrestricted)
|
|
45
|
+
# AGENT_DENIED_PATHS=/etc,/root # Comma-separated denied dirs
|
|
46
|
+
# AGENT_WORKDIR= # Working directory override
|
|
47
|
+
|
|
48
|
+
# MCP servers (format: name|transport|url, comma-separated)
|
|
49
|
+
# transport: sse, http, or stdio
|
|
50
|
+
# MCP_SERVERS=mesh|sse|http://localhost:8200/sse,memory|stdio|~/agent-memory/agent-memory mcp
|
|
51
|
+
|
|
52
|
+
# Screenbox (virtual desktop)
|
|
53
|
+
# SCREENBOX_URL=http://localhost:8080
|
|
54
|
+
|
|
55
|
+
# Security
|
|
56
|
+
# AGENT_SECURITY_POLICY=normal # normal, strict, permissive
|
|
57
|
+
# AGENT_SECURITY_DISABLE=false # Disable all security (NOT recommended)
|
|
58
|
+
# AGENT_CONTENT_GATE_BLOCK_INJECTIONS=true # Block detected prompt injections
|
|
59
|
+
# AGENT_MEMORY_HMAC_KEY= # HMAC key for memory integrity (auto-generated if empty)
|
|
60
|
+
# AGENT_PAIRING_SECRET= # Secret for agent pairing protocol
|
|
61
|
+
|
|
62
|
+
# Server
|
|
63
|
+
# AGENT_PORT=3000 # HTTP API port
|
|
64
|
+
# AGENT_PARENT_PORT= # Parent agent port (child agents only)
|
|
65
|
+
# AGENT_DEPTH=0 # Agent nesting depth (0=root, auto-set for children)
|
|
66
|
+
|
|
67
|
+
# Sessions & logging
|
|
68
|
+
# AGENT_SESSION_RETENTION_DAYS=30 # Auto-delete sessions older than N days
|
|
69
|
+
# AGENT_LOG_LEVEL=info # debug, info, warn, error
|
|
70
|
+
# AGENT_LOG_RETENTION_DAYS=7 # Auto-delete logs older than N days
|
|
71
|
+
# AGENT_CLEANUP_INTERVAL_MIN=60 # Log cleanup interval in minutes
|
|
72
|
+
|
|
73
|
+
# Timeouts
|
|
74
|
+
# AGENT_IDLE_TIMEOUT=0 # Auto-exit after N seconds idle (0=disabled)
|
|
75
|
+
# AGENT_CHILD_IDLE_TIMEOUT=300 # Child agent idle timeout (seconds)
|
|
76
|
+
# AGENT_CHILD_CLEANUP_DELAY=5000 # Delay before cleaning up dead children (ms)
|
|
77
|
+
|
|
78
|
+
# Context management
|
|
79
|
+
# COMPRESS_AFTER_TOKENS=50000 # Compress context after N tokens
|
|
80
|
+
# AGENT_PROFILE=default # Active profile name
|
|
81
|
+
|
|
82
|
+
# Intent detection
|
|
83
|
+
# INTENT_MODE=regex # regex, ai, hybrid
|
|
84
|
+
# INTENT_MODEL= # Model for AI intent detection
|
|
85
|
+
|
|
86
|
+
# Budget
|
|
87
|
+
# AGENT_BUDGET_WARNINGS=true # Show cost warnings
|
|
88
|
+
|
|
89
|
+
# Agent memory (external binary)
|
|
90
|
+
# AGENT_MEMORY_BIN=agent-memory # Path to agent-memory binary
|
|
91
|
+
|
|
92
|
+
# Shell
|
|
93
|
+
# AGENT_SHELL=bash # Shell for run_command tool
|
|
94
|
+
# FLINT_ENV_DIR=~/.flint/env # Flint's own venv + npm prefix, first on PATH for commands
|
|
95
|
+
# FLINT_OWN_ENV=1 # 0 = commands run with the system python/npm only
|
|
96
|
+
|
|
97
|
+
# Self-verification: after "done" on a turn that changed files and ran nothing,
|
|
98
|
+
# one more round asks the model to show the change works. Off by default; turn it
|
|
99
|
+
# on for a weaker model that stops before checking its work.
|
|
100
|
+
# FLINT_SELF_VERIFY=on
|
|
101
|
+
|
|
102
|
+
# Plugins
|
|
103
|
+
# FLINT_PLUGIN_INSTALL=ask # ask = install_plugin/reload_plugins always need approval,
|
|
104
|
+
# # even for API callers (unattended runs are refused); allow = no asking
|
|
105
|
+
# FLINT_PLUGINS_DIR=~/.flint/plugins
|
|
106
|
+
|
|
107
|
+
# Memory (optional Mesh integration)
|
|
108
|
+
# MEMORY_API_URL=http://localhost:8200
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Flint are written here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
|
|
5
|
+
[Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
Each version is a `## [x.y.z] - YYYY-MM-DD` heading: `/update` reads these
|
|
8
|
+
headings to show what changed between your version and the newest one.
|
|
9
|
+
|
|
10
|
+
## [1.14.0] - 2026-10-02
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- First public release. Flint is an AI agent for the terminal: it reads and
|
|
14
|
+
edits files, runs commands, searches and fetches the web, plans and tracks
|
|
15
|
+
tasks, starts child agents and remembers what it learned across sessions.
|
|
16
|
+
- Seven providers out of the box (OpenRouter, OpenAI, Anthropic, Gemini,
|
|
17
|
+
Groq, Together, local Ollama), switched at runtime with `/provider` and
|
|
18
|
+
`/model`; more can be added in `~/.flint/providers.json`. API keys are
|
|
19
|
+
stored encrypted.
|
|
20
|
+
- Free mode (`/model free`) lists OpenRouter's free models that can call
|
|
21
|
+
tools, and `/model test` scores a model on small checked tasks.
|
|
22
|
+
- Care levels (`/careful`) decide what asks before it runs; spend levels
|
|
23
|
+
(`/spend`) decide how much context and how many tools a turn uses.
|
|
24
|
+
- Context swap keeps long sessions inside the model's window without
|
|
25
|
+
losing old tool results.
|
|
26
|
+
- MCP servers over HTTP, SSE and stdio, with `tool_search` when they bring
|
|
27
|
+
more tools than a turn should carry.
|
|
28
|
+
- HTTP API on 127.0.0.1 with a bearer token, headless runs
|
|
29
|
+
(`--headless --task`) and a stream-json stdio mode for host programs.
|
|
30
|
+
- `/update` installs a newer version and continues the same session.
|
|
31
|
+
|
|
32
|
+
### Security
|
|
33
|
+
- The HTTP API lets a program in only after pairing with a PIN shown in the
|
|
34
|
+
console. Pairings survive restarts (only a hash is stored) and are listed
|
|
35
|
+
and revoked with `/paired`. The token file `~/.flint/api-token.json` is
|
|
36
|
+
used only with `FLINT_API_TOKEN_FILE=1`.
|
|
37
|
+
- At start, messages an earlier run left in the queue for another session,
|
|
38
|
+
or older than 10 minutes, are not run.
|
|
39
|
+
- Commands refused at every level now include the Windows ways to wipe a
|
|
40
|
+
disk (`Format-Volume`, `Clear-Disk`, `diskpart`, `rd /s /q` or
|
|
41
|
+
`Remove-Item -Recurse` on a drive root), and quoting a path no longer gets
|
|
42
|
+
a refused command through (`rm -rf "/"`).
|
|
43
|
+
- Writes into the operating system's folders (`C:Windows`, `Program Files`,
|
|
44
|
+
`/etc`, `/usr` and the like) are refused at every level, also when Flint
|
|
45
|
+
runs as administrator.
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
- The console starts with the FLiNT mark (titanium letters, a yellow spark
|
|
49
|
+
over the i) instead of the old mascot, and the window title alternates a gear and
|
|
50
|
+
a spark while Flint works.
|
|
51
|
+
- Flint needs Node.js 22.12 or newer. Its SQLite binding no longer builds
|
|
52
|
+
for Node 20, which reached end of life in April 2026.
|
|
53
|
+
- The HTTP API and everything that calls it use `127.0.0.1`. On Node 22
|
|
54
|
+
`localhost` resolves to `::1` first, where nothing listens, so a parent
|
|
55
|
+
could not reach its child agents.
|
package/FEATURES.md
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Flint: What Can This Agent Do?
|
|
2
|
+
|
|
3
|
+
**Flint** is a terminal AI agent that reads code, edits files, runs commands, browses the web, drives desktops through MCP servers, manages tasks and remembers what it learned.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Why Flint?
|
|
8
|
+
|
|
9
|
+
- A terminal console built for long work: scrollback history, a small live zone, one line per tool call
|
|
10
|
+
- Any LLM provider (OpenRouter, Anthropic, OpenAI, Gemini, Groq, Together, local Ollama), free models included
|
|
11
|
+
- Switch models mid-conversation
|
|
12
|
+
- Desktop and browser automation through MCP servers
|
|
13
|
+
- Child agents for parallel work
|
|
14
|
+
- Plugin SDK and MCP protocol support
|
|
15
|
+
- Self-hosted, runs anywhere; headless and stream-json modes for CI and hosts
|
|
16
|
+
- Autonomous mode with plans, spend modes, context swap for long sessions
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Core Capabilities
|
|
21
|
+
|
|
22
|
+
### 1. Code & Files
|
|
23
|
+
- Read, write, edit, search, copy, move, delete files
|
|
24
|
+
- Glob patterns (`**/*.js`), regex search across the codebase
|
|
25
|
+
- Syntax-highlighted code blocks in the terminal
|
|
26
|
+
- Checkpoint and rewind: undo file changes (`/rewind`)
|
|
27
|
+
- Context compression and context swap for long sessions (see Smart Features)
|
|
28
|
+
|
|
29
|
+
### 2. Shell & Processes
|
|
30
|
+
- Run shell commands (120 s timeout by default, up to 600 s per call; `AGENT_COMMAND_TIMEOUT` changes the default)
|
|
31
|
+
- Background processes with output kept for later reading
|
|
32
|
+
- Process manager: list, peek output, kill (`/ps`, `/logs <id>`, `/kill <id>`)
|
|
33
|
+
- Stopping a command stops its whole process tree
|
|
34
|
+
|
|
35
|
+
### 3. Web
|
|
36
|
+
- Fetch any URL (HTML reduced to text, 5000 characters by default)
|
|
37
|
+
- Web search: DuckDuckGo first, then Bing, then Google
|
|
38
|
+
|
|
39
|
+
### 4. Desktop Automation (through MCP)
|
|
40
|
+
- Desktop and browser tools come from an MCP server; Flint has no built-in desktop tools
|
|
41
|
+
- **Supervisor mode** (`/supervisor on`): watches tool calls and injects hints, for example to look before clicking on a remote desktop or to discard a recovery dialog
|
|
42
|
+
|
|
43
|
+
### 5. Multi-Agent
|
|
44
|
+
- Spawn child agents with different models and profiles (`spawn_agent`)
|
|
45
|
+
- `ask_agent` waits for the child's answer; `wait_tasks` waits for delegated work
|
|
46
|
+
- Each child runs on its own port with its own data folder, and stops itself after an idle timeout
|
|
47
|
+
- Child agents can push datasets back to the parent
|
|
48
|
+
|
|
49
|
+
### 6. Memory & Knowledge
|
|
50
|
+
- Persistent memory in SQLite (full-text search, plus vector search when `sqlite-vec` loads) that carries across sessions
|
|
51
|
+
- Skills: reusable procedures kept as markdown files under `~/.flint/memory/skills/`
|
|
52
|
+
- Optional Mesh integration (`MEMORY_API_URL`): semantic document search with auto-tagging
|
|
53
|
+
- Session facts extracted during compression, so key decisions survive
|
|
54
|
+
|
|
55
|
+
### 7. Task Planning
|
|
56
|
+
- Plans with goals, tasks and subtasks, notes and linked files
|
|
57
|
+
- SQLite-backed, survives restarts
|
|
58
|
+
- Autonomous mode (`/auto <task>`): the agent creates a plan and works through it; `/continue` resumes it
|
|
59
|
+
|
|
60
|
+
### 8. Multi-Provider LLM
|
|
61
|
+
- 7 providers: OpenRouter, OpenAI, Anthropic, Groq, Together, Gemini, Ollama (local); more can be added in `~/.flint/providers.json` (see [docs/providers.md](docs/providers.md))
|
|
62
|
+
- Switch with `/provider`, `/model <id>` or the `switch_model` tool
|
|
63
|
+
- Encrypted API key storage (AES-256-GCM, DPAPI on Windows)
|
|
64
|
+
- Live pricing and OpenRouter balance checking
|
|
65
|
+
- First-run wizard for setup
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Smart Features
|
|
70
|
+
|
|
71
|
+
### Tool Selection
|
|
72
|
+
With `INTENT_MODEL` set, a small classifier model picks the tools offered for each turn. Without it the classifier is off: every turn gets the built-in tools, MCP tools are offered whole up to a limit set by the spend mode (30 in normal), and past that through `tool_search`.
|
|
73
|
+
|
|
74
|
+
### Spend Modes (`/spend`)
|
|
75
|
+
`economy`, `normal` (default) and `generous` set together how many MCP tools are offered whole, when compression and swap start, and swap's sizes. The footer shows `spend: <level>`; `FLINT_SPEND` overrides. See [docs/spend-modes.md](docs/spend-modes.md).
|
|
76
|
+
|
|
77
|
+
### Compression and Context Swap
|
|
78
|
+
Context compresses only when it passes a threshold derived from the model's window (half of it in normal mode, capped at 128,000 tokens); `COMPRESS_AFTER_TOKENS` sets a fixed value. Before that, context swap moves big old tool results to the session folder and leaves a one-line stub; `swap_list` and `swap_read` bring them back. In long talks the oldest whole turns become one swap entry with a short summary. `FLINT_SWAP=0` turns swap off. See [docs/context-swap.md](docs/context-swap.md).
|
|
79
|
+
|
|
80
|
+
### Free Mode (`/model free`)
|
|
81
|
+
Lists OpenRouter's free models that can call tools, with speed and uptime from OpenRouter's stats. `/model free auto` takes the best one with two fallbacks from other vendors. The footer counts today's free requests against the account's limit. See [docs/free-mode.md](docs/free-mode.md).
|
|
82
|
+
|
|
83
|
+
### Model Check (`/model test`)
|
|
84
|
+
Runs six small agent tasks with checked answers on a model, in the background, and saves the score; the free list shows it. See [docs/model-check.md](docs/model-check.md).
|
|
85
|
+
|
|
86
|
+
### Care Levels (`/careful`)
|
|
87
|
+
`safe` (every tool whose default is to ask does, and every command), `normal` (file writes and commands run; deleting a file, child agents, MCP tools and destructive or one-way commands ask) or `permissive` (only deleting a file and `reconnect_mcp` ask). Reads never ask, except for secret files such as `.env` or SSH keys, which ask at every level, as do plugin installs. Hard blocks stay blocked at every level.
|
|
88
|
+
|
|
89
|
+
### Sessions That Continue
|
|
90
|
+
`/resume` picks a recent session; `/restart` and `/update` continue the same session. A resumed session shows its last 80 lines.
|
|
91
|
+
|
|
92
|
+
### Self-Update (`/update`)
|
|
93
|
+
Flint says when a newer version is out (at most once a day) and `/update` installs it and restarts. It refuses when there are local changes. `FLINT_UPDATE_CHECK=0` turns the check off. See [docs/self-update.md](docs/self-update.md).
|
|
94
|
+
|
|
95
|
+
### Stdio Mode
|
|
96
|
+
`flint --print --input-format stream-json --output-format stream-json ...` runs Flint under a host that speaks stream-json over stdin and stdout. It reads the folder's `CLAUDE.md` and `.mcp.json`. See [docs/stdio-mode.md](docs/stdio-mode.md).
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Security
|
|
101
|
+
|
|
102
|
+
The security layer lives in `src/security/` and is always on: `AGENT_SECURITY_DISABLE=1` is honoured only under `NODE_ENV=test`.
|
|
103
|
+
|
|
104
|
+
| Module | What it does |
|
|
105
|
+
|--------|-------------|
|
|
106
|
+
| `content-fence.js` | Content gate for every tool result: size limits, session delimiters, secret redaction, prompt injection detection |
|
|
107
|
+
| `content-validator.js` | Detects a file's real type by magic bytes |
|
|
108
|
+
| `persona-guard.js` | Checks the model's reply for signs of persona hijacking |
|
|
109
|
+
| `path-guard.js` | Blocks critical paths, resolves symlinks, detects secret files |
|
|
110
|
+
| `command-guard.js` | Blocks dangerous shell commands, asks for destructive ones |
|
|
111
|
+
| `network-guard.js` | Blocks requests to private IP ranges, rate limits |
|
|
112
|
+
| `child-policy.js` | Limits child agent nesting depth |
|
|
113
|
+
| `api-auth.js` | Bearer token for the HTTP API |
|
|
114
|
+
| `pairing.js` | PIN-based pairing for peer agents |
|
|
115
|
+
| `audit.js` | JSON-line audit log (`audit.jsonl` in the sessions folder) |
|
|
116
|
+
| `watchdog.js` | Memory usage and self-modification checks |
|
|
117
|
+
| `policies.js` | Security policies and care levels |
|
|
118
|
+
| `safety-constants.js` | Limits that no config or env var can change |
|
|
119
|
+
| `index.js` | Wires the hooks together |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Console
|
|
124
|
+
|
|
125
|
+
There are no tabs. History is ordinary terminal scrollback, written once; only a small live zone at the bottom redraws. See [docs/console-spec.md](docs/console-spec.md).
|
|
126
|
+
|
|
127
|
+
- Each tool call is one dim ledger line (category, verb, argument, result, time)
|
|
128
|
+
- Each turn ends with a receipt: tools, files changed, tokens in and out, time, cost
|
|
129
|
+
- Footer: activity (spinner, verb, time, tokens arriving), model, cost, context size and limit, background count, care level, spend level
|
|
130
|
+
- Messages typed during a turn wait above the input until the agent takes them in
|
|
131
|
+
- Approvals show the whole command and take one key
|
|
132
|
+
- `/ps`, `/tools [n]` and `/sys` print what the former Processes, Tool Log and System tabs showed
|
|
133
|
+
|
|
134
|
+
**Keyboard:**
|
|
135
|
+
- Esc: clear the input, stop the turn, then stop background processes, newest first
|
|
136
|
+
- Ctrl+C: stop the turn; twice within 2 s exits
|
|
137
|
+
- Alt+V: paste a picture (or text) from the clipboard into the input
|
|
138
|
+
- Up/Down: input history
|
|
139
|
+
- Ctrl+U: clear the input line; Ctrl+W: delete the last word
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Commands
|
|
144
|
+
|
|
145
|
+
| Command | What it does |
|
|
146
|
+
|---------|-------------|
|
|
147
|
+
| `/new` | Fresh session |
|
|
148
|
+
| `/clear` | Clear context, keep session |
|
|
149
|
+
| `/sessions` | List saved sessions |
|
|
150
|
+
| `/resume` | Pick a recent session to continue (or `/resume <id>`) |
|
|
151
|
+
| `/load <id>` | Load a session |
|
|
152
|
+
| `/model [id]` | Show or switch the model; `/model free`, `/model test` |
|
|
153
|
+
| `/provider` | Show or switch the provider |
|
|
154
|
+
| `/key` | Manage API keys |
|
|
155
|
+
| `/spend` | Spend mode: economy, normal, generous |
|
|
156
|
+
| `/careful` | Care level: safe, normal, permissive |
|
|
157
|
+
| `/profile <name>` | Switch profile |
|
|
158
|
+
| `/auto <task>` | Autonomous mode: the agent plans and executes |
|
|
159
|
+
| `/continue` | Resume autonomous work |
|
|
160
|
+
| `/plan` | Show the current plan |
|
|
161
|
+
| `/tasks` | Task dashboard |
|
|
162
|
+
| `/supervisor` | Toggle the real-time supervisor |
|
|
163
|
+
| `/permissions` | Show tool permissions (`/allow`, `/deny`, `/confirm`, `/allow-all`, `/deny-all`, `/reset-permissions`) |
|
|
164
|
+
| `/ps`, `/logs <id>`, `/kill <id>` | Background processes |
|
|
165
|
+
| `/tools [n]`, `/sys` | Last tool calls; model, cost, context, MCP and session |
|
|
166
|
+
| `/mcp` | MCP server status |
|
|
167
|
+
| `/agents` | List running agent instances |
|
|
168
|
+
| `/rewind` | Undo file changes (`/rewind N`, `/rewind all`) |
|
|
169
|
+
| `/paste` | Send the clipboard (text or image) |
|
|
170
|
+
| `/memory` | Memory stats |
|
|
171
|
+
| `/plugins` | List plugins (`/install`, `/uninstall`) |
|
|
172
|
+
| `/update` | Install a newer Flint and restart |
|
|
173
|
+
| `/restart` | Restart, same session |
|
|
174
|
+
| `/help` | Full help |
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Tools (built-in, plus MCP)
|
|
179
|
+
|
|
180
|
+
The Mesh tools are registered only when `MEMORY_API_URL` is set; the swap tools are off with `FLINT_SWAP=0`.
|
|
181
|
+
|
|
182
|
+
### Files
|
|
183
|
+
`read_file` `write_file` `edit_file` `delete_file` `copy_file` `move_file` `create_directory` `list_directory` `glob` `search_in_files` `view_image`
|
|
184
|
+
|
|
185
|
+
### Shell & Processes
|
|
186
|
+
`run_command` `run_background_command` `list_processes` `kill_process` `peek_process`
|
|
187
|
+
|
|
188
|
+
### Web
|
|
189
|
+
`web_fetch` `web_search`
|
|
190
|
+
|
|
191
|
+
### Memory & Skills
|
|
192
|
+
`memory_write` `memory_search` `memory_get` `memory_delete` `memory_expand` `skill_add` `skill_update` `skill_remove`
|
|
193
|
+
|
|
194
|
+
### Mesh
|
|
195
|
+
`mesh_search` `mesh_add` `mesh_recent`
|
|
196
|
+
|
|
197
|
+
### Planning
|
|
198
|
+
`create_plan` `update_task` `list_tasks` `add_task` `add_task_note` `link_task_file` `create_subtask` `focus_goal` `task_stats` `list_goals` `today`
|
|
199
|
+
|
|
200
|
+
### Agents
|
|
201
|
+
`spawn_agent` `ask_agent` `list_agents` `wait_tasks`
|
|
202
|
+
|
|
203
|
+
### Control
|
|
204
|
+
`think` `check_balance` `list_models` `switch_model` `switch_provider` `list_providers` `list_mcp_servers` `reconnect_mcp` `restart_agent` `clear_context`
|
|
205
|
+
|
|
206
|
+
### Context, Data and Plugins
|
|
207
|
+
`tool_search` `swap_list` `swap_read` `show_dataset` `check_inbox` `install_plugin` `reload_plugins`
|
|
208
|
+
|
|
209
|
+
### + MCP tools
|
|
210
|
+
Any MCP server adds its tools. Servers come from `MCP_SERVERS`, and in stdio mode also from the folder's `.mcp.json`.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Profiles
|
|
215
|
+
|
|
216
|
+
| Profile | Best for |
|
|
217
|
+
|---------|----------|
|
|
218
|
+
| **generic** | Coding, file ops, general tasks (default) |
|
|
219
|
+
| **generic-full** / **generic-mini** | The generic prompt with full or minimal context |
|
|
220
|
+
| **desktop** | GUI automation, browser, apps |
|
|
221
|
+
| **marketer** | Content, research, competitive analysis |
|
|
222
|
+
| **ux-reviewer** | UI/UX audits, accessibility |
|
|
223
|
+
|
|
224
|
+
Custom profiles: add a prompt file in `profiles/` and an entry for it in `profiles/profiles.json`.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Setup
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
npm install -g flint-agent
|
|
232
|
+
flint
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Or from the repository:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
git clone https://github.com/dklymentiev/flint-agent.git
|
|
239
|
+
cd flint-agent
|
|
240
|
+
npm install
|
|
241
|
+
npm link
|
|
242
|
+
flint
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The first run picks a provider, takes your API key and asks how careful Flint should be.
|
|
246
|
+
|
|
247
|
+
### Optional
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# MCP servers
|
|
251
|
+
echo 'MCP_SERVERS=myserver|http|http://localhost:5000' >> .env
|
|
252
|
+
|
|
253
|
+
# Desktop profile
|
|
254
|
+
flint --profile desktop
|
|
255
|
+
|
|
256
|
+
# Headless mode
|
|
257
|
+
flint --headless --task "Fix the bug" --cwd /path/to/project
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## API
|
|
263
|
+
|
|
264
|
+
HTTP server on `127.0.0.1` for external integrations. A program pairs once with a PIN shown in the console (`/paired` lists and revokes them); everything except `GET /status` and the pairing endpoints needs its `Authorization: Bearer <token>`.
|
|
265
|
+
|
|
266
|
+
| Endpoint | Method | Description |
|
|
267
|
+
|----------|--------|-------------|
|
|
268
|
+
| `/message` | POST | Send a message; returns a message id (`?sync=true` waits for the answer) |
|
|
269
|
+
| `/message/:id` | GET | Poll a message's status and result |
|
|
270
|
+
| `/status` | GET | Model, message count, usage and cost |
|
|
271
|
+
| `/history` | GET | Conversation history |
|
|
272
|
+
| `/model` | GET | Current model and pricing |
|
|
273
|
+
| `/plan` | GET | Current task plan |
|
|
274
|
+
| `/datasets` | GET | Active datasets |
|
|
275
|
+
| `/dataset` | POST | Push a dataset (from a child agent) |
|
|
276
|
+
| `/queue` | GET | Queued messages |
|
|
277
|
+
| `/queue` | DELETE | Clear the queue |
|
|
278
|
+
| `/bus/log` | GET | Message bus log |
|
|
279
|
+
| `/bus/stats` | GET | Message bus counts |
|
|
280
|
+
| `/command` | POST | Execute a slash command |
|
|
281
|
+
| `/continue` | POST | Resume autonomous work |
|
|
282
|
+
| `/stop` | POST | Abort the current task |
|
|
283
|
+
| `/restart` | POST | Restart, same session |
|
|
284
|
+
| `/pair/request` | POST | Start pairing (the PIN is shown in the console) |
|
|
285
|
+
| `/pair/confirm` | POST | Confirm pairing with the PIN, returns a token |
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Testing
|
|
290
|
+
|
|
291
|
+
Unit and integration tests run on vitest:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
npm test # run all tests
|
|
295
|
+
npm run test:unit # unit tests
|
|
296
|
+
npm run test:integration # integration tests
|
|
297
|
+
npm run test:watch # watch mode
|
|
298
|
+
```
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dmytro Klymentiev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|