You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-14Lines changed: 26 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Built by [Techopolis](https://techopolisonline.com).
15
15
-**Guardrail Recovery**: Automatic session eviction on safety violations prevents refusal spirals — a single bad message does not poison the entire conversation
16
16
-**Soft Refusal Detection**: Detects when the model returns a refusal as normal text (not an exception) and resets the session to keep follow-up messages working
17
17
-**Concurrency Control**: Configurable semaphore limits concurrent inference calls (default 3) with FIFO queuing for additional requests
18
-
-**Tool Calling**: File system tools (read, write, edit, delete, move, list directory, create directory, check path)
18
+
-**Tool Calling**: OpenAI-compatible delegated tool calls for agent harnesses, plus server-local file and terminal tools for built-in/local requests
19
19
-**Auto-Updates**: Sparkle 2 checks for updates daily and shows a dock badge when one is available
20
20
-**Privacy First**: All processing happens on-device — no data leaves your Mac
21
21
@@ -358,7 +358,7 @@ For comparison, you can also configure cloud-hosted models in Xcode 26 Intellige
358
358
359
359
Visit [OpenRouter.ai](https://openrouter.ai) to get an API key that provides access to models from Anthropic, OpenAI, Google, and others through a single endpoint.
360
360
361
-
However, afm-server offers the advantage of completely local, private AI assistance without requiring API keys or incurring usage costs.
361
+
However, afm-server offers the advantage of completely local, private AI assistance without cloud API keys or usage costs. The local server still uses a user-configurable API key to protect its loopback endpoints.
362
362
363
363
### Cursor IDE
364
364
@@ -392,26 +392,38 @@ Any application that supports custom OpenAI API endpoints can use afm-server:
392
392
393
393
- Set the API base URL to `http://127.0.0.1:11435/v1`
394
394
- Use `apple.local` as the model name
395
-
- API key is not required (but can be set to any value if the client requires it)
395
+
- Set the client API key to the value shown in afm-server Settings or the dashboard API Key card
396
+
- afm-server accepts that key as `Authorization: Bearer <API key>`
396
397
397
398
## Tool Calling
398
399
399
-
The server supports tool calling for file operations within a sandboxed workspace:
400
+
afm-server supports two tool paths:
400
401
401
-
### Available Tools
402
+
### Client-Delegated Tools
402
403
403
-
-`read_file`: Read file contents
404
-
-`write_file`: Create or write content to a file
405
-
-`edit_file`: Modify a file by replacing text
406
-
-`delete_file`: Remove a file
407
-
-`move_file`: Move or rename a file
408
-
-`list_directory`: List directory contents
409
-
-`create_directory`: Create new directories
410
-
-`check_path`: Check if a path exists and get its type
404
+
When an OpenAI-compatible client sends a `tools` array to `POST /v1/chat/completions`, afm-server behaves like a model backend. It can return an assistant message with `tool_calls` and `finish_reason: "tool_calls"`. The connecting client, such as Pi, Hermes, OpenClaw, or another coding harness, is responsible for executing those tools on the client machine and sending the results back as `role: "tool"` messages.
405
+
406
+
This is the correct path for agentic coding work because the harness owns the workspace, terminal, approvals, and tool registry.
407
+
408
+
Streaming requests also emit OpenAI-style `delta.tool_calls` chunks so clients that keep `stream: true` can still see tool calls.
409
+
410
+
### Server-Local Tools
411
+
412
+
When no client tools are provided, afm-server can use Apple Foundation Models native Swift tools for local file and terminal requests. These tools run inside the afm-server process on the Mac hosting the server:
413
+
414
+
-`bash`: Execute a short shell command on the server Mac
415
+
-`read_file`: Read file contents on the server Mac
416
+
-`write_file`: Create or write content to a file on the server Mac
417
+
-`edit_file`: Modify a file by replacing text on the server Mac
418
+
-`delete_file`: Remove a file on the server Mac
419
+
-`move_file`: Move or rename a file on the server Mac
420
+
-`list_directory`: List directory contents on the server Mac
421
+
-`create_directory`: Create new directories on the server Mac
422
+
-`check_path`: Check if a path exists and get its type on the server Mac
411
423
412
424
### Workspace Configuration
413
425
414
-
Set the `PI_WORKSPACE_ROOT` environment variable to specify the root directory for file operations. If not set, it defaults to your Documents folder.
426
+
Set the `PI_WORKSPACE_ROOT` environment variable to specify the root directory for server-local file operations. If not set, it defaults to your Documents folder.
letdescription="Execute a short local terminal command and return stdout plus stderr. Use this for real local facts, repo checks, git status, ls, rg, find, build, and test commands."
788
+
789
+
@Generable
790
+
structArguments{
791
+
@Guide(description:"The shell command to execute, such as pwd, ls -la ~/Developer, git status --short, or rg -n pattern")
792
+
letcommand:String
793
+
794
+
@Guide(description:"Working directory for the command. Use ~/Developer or a project path when relevant. Defaults to the user's home directory.")
795
+
letworkingDirectory:String?
796
+
797
+
@Guide(description:"Timeout in seconds. Defaults to 10 and is capped at 120.")
0 commit comments