2.9 KiB
2.9 KiB
SKILL: Native Function Calling (Universal Literate Note)
- Overview
- Phase A: Demand (PRD)
- Phase B: Blueprint (PROTOCOL)
- Phase D: Build (Implementation)
- Registration
Overview
The Native Function Calling skill provides the translation layer between the system's deterministic Lisp interfaces and the LLM's neural tool-calling capabilities. It ensures that System 1 (the LLM) interacts with the world via structured, validated schemas rather than raw text plists, virtually eliminating "formatting hallucinations."
Phase A: Demand (PRD)
1. Purpose
Define a high-reliability bridge for LLM-native "Tool Use."
2. User Needs
- Schema Generation: Automatically convert Lisp `defun` signatures into JSON Schema tool definitions.
- Reliable Ingress: Parse the LLM's structured `tool_calls` response back into a valid Lisp plist.
- Provider Agnostic: Support schema formats for Gemini, OpenAI, and Anthropic.
- Validation: Ensure arguments match the required types before reaching System 2.
3. Success Criteria
TODO Lisp-to-JSON Schema conversion logic verification
TODO Multi-provider schema formatting (Gemini vs OpenAI)
TODO Response parsing from tool_call to symbolic action
Phase B: Blueprint (PROTOCOL)
1. Architectural Intent
Interfaces for schema translation and response normalization. Source of truth is the Lisp signatures in the `PROTOCOL.org` blocks.
2. Semantic Interfaces
(defun lisp-signature-to-schema (fn-name params docstring)
"Transforms a Lisp function definition into a JSON Schema tool object.")
(defun normalize-tool-call (raw-response)
"Parses the LLM response and returns a standard :REQUEST action plist.")
Phase D: Build (Implementation)
Schema Generator
(defun lisp-signature-to-schema (fn-name params docstring)
"Simplified schema generator for the refactor."
(let ((schema `((:name . ,(string-downcase (string fn-name)))
(:description . ,docstring)
(:parameters . ((:type . "object")
(:properties . ,(loop for p in params
collect (cons p '((:type . "string"))))))))))
schema))
Kernel Integration
(defun get-available-tools ()
"Gathers all registered Lisp interfaces and returns them as a JSON Schema array."
;; Logic to scan skills-registry and collect function signatures
nil)
Registration
(defskill :skill-function-calling
:priority 100 ; Foundational bridge
:trigger (lambda (context) nil)
:neuro (lambda (context) nil)
:symbolic (lambda (action context) action))