agentleFS
Seeed-ProjectsSeeed-Projects/Seeed-Jetson-DevelopTool/skills/claude/llm-interface-control/CLAUDE.md

Seeed-Jetson-DevelopTool / llm-interface-control

CLAUDE.md57 starsChanged 4 months agoMITView on GitHub

Deploy a local LLM agent on Jetson Orin NX that translates natural language into structured JSON commands for hardware interface control (GPIO, PWM, I2C). Uses Ollama with a custom system prompt, FastAPI backend, and confidence-gated execution. Requires JetPack and Python 3.8+.

  • Pipes a download into a shell
  • Installs packages
  • Sends data out

The file

We split this CLAUDE.md into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run one phase at a time. After each phase:

    line 14
  2. Very specific:

    If output contains [STOP] → stop, consult the failure decision tree.

    line 16
  3. Very specific:

    If output ends with [OK] → tell the user "Phase N complete" and proceed.

    line 17
  4. Distinctive:

    Test rejection of off-topic input:

    line 115

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

Local LLM Agent for Hardware Interface Control on Jetson

Use a local LLM running on Jetson to translate natural language commands into structured JSON for controlling hardware interfaces (lights, fans, thermostats, speakers) via GPIO, PWM, and I2C. The system uses Ollama with a custom prompt, FastAPI for the API layer, and confidence-based safety gating.


Execution model

Run one phase at a time. After each phase:

  • Relay all output to the user.
  • If output contains [STOP] → stop, consult the failure decision tree.
  • If output ends with [OK] → tell the user "Phase N complete" and proceed.

Prerequisites

RequirementDetail
HardwareNVIDIA Jetson (Orin NX recommended) with JetPack
Python3.8+
LLM ServerOllama (installed in Phase 1)
NetworkLocal access for API calls

Phase 1 — Install Ollama (~2 min)

curl -fsSL https://ollama.com/install.sh | sh

Verify:

ollama --version

[OK] when Ollama version is printed. [STOP] if install fails — check network connectivity.


Phase 2 — Clone the project and install dependencies (~2 min)

git clone https://github.com/kouroshkarimi/llm_interface_controll.git
cd llm_interface_controll
pip install -r requirements.txt

[OK] when all packages install (FastAPI, uvicorn, etc.). [STOP] if pip fails — check Python version.


Phase 3 — Create the custom Ollama model (~2 min)

The project includes a system prompt file that constrains the LLM to output only structured JSON with fields: intent, device, action, location, parameters, confidence.

cd llm_interface_controll
ollama create jetson-controller -f models/jetson-controller.txt

Verify:

ollama list | grep jetson-controller

[OK] when jetson-controller appears in the model list. [STOP] if creation fails — ensure the base model (llama3.2:1b) is available: ollama pull llama3.2:1b.


Phase 4 — Start the FastAPI server (~1 min)

cd llm_interface_controll
uvicorn app.main:app --host 0.0.0.0 --port 8000

[OK] when uvicorn prints "Application startup complete".


Phase 5 — Test command execution (~1 min)

In a separate terminal, send a test command:

curl -X POST http://localhost:8000/command \
  -H "Content-Type: application/json" \
  -d '{"text": "Turn on the kitchen lights"}'

Expected response: JSON with intent: "control_device", device: "lights", action: "turn_on", location: "kitchen", confidence: >0.8.

Test a query:

curl -X POST http://localhost:8000/command \
  -H "Content-Type: application/json" \
  -d '{"text": "What is the temperature in the bedroom?"}'

Expected: intent: "query_status", device: "thermostat".

Test rejection of off-topic input:

curl -X POST http://localhost:8000/command \
  -H "Content-Type: application/json" \
  -d '{"text": "Write me a poem about the ocean"}'

Expected: intent: "unknown", confidence: 0.0.

[OK] when all three tests return properly structured JSON.


Failure decision tree

SymptomAction
Ollama install failsCheck internet. Try manual download from ollama.com.
ollama create failsEnsure base model is pulled: ollama pull llama3.2:1b. Check models/jetson-controller.txt exists.
FastAPI won't startCheck port 8000 not in use: ss -tlnp | grep 8000. Verify requirements installed.
LLM returns non-JSON outputThe system prompt may not be loaded. Recreate: ollama create jetson-controller -f models/jetson-controller.txt.
Low confidence on valid commandsAdjust temperature in app/llm_agent.py. Try a larger base model.
GPIO/hardware errorsMock hardware during development. Ensure Jetson GPIO permissions: sudo usermod -aG gpio $USER.
Connection refused on port 8000Firewall: sudo ufw allow 8000. Verify uvicorn is running.

Reference files

  • references/source.body.md — Full project documentation with architecture details, JSON schema specification, customization guide, and safety constraints (reference only)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.