Skip to content

[WIP] feat(local-ai): on-device local AI inference via llama.cpp (OpenCL) - #395

Draft
aixtin wants to merge 4 commits into
yuga-hashimoto:mainfrom
aixtin:feat/local-ai
Draft

aixtin wants to merge 4 commits into
yuga-hashimoto:mainfrom
aixtin:feat/local-ai

Conversation

@aixtin

@aixtin aixtin commented Oct 21, 2026

Copy link
Copy Markdown

feat(local-ai): on-device local AI inference via llama.cpp (OpenCL)

Summary

Adds an on-device local AI option to and-code, powered by llama.cpp with the Adreno OpenCL backend. Users can import GGUF models, run llama-server in a proot sandbox, and chat with the local model directly from the app — no cloud dependency.

Verification (real device: OnePlus Ace 3 Pro / PJX110 / Adreno 750 / KSU)

  • llama.cpp 0.6.0-dev, OpenCL backend, -ngl 24 -ctk f16 -ctv f16
  • Model: qwen3-0.6b-q4_0.gguf (447 MB) — Q4_0 confirmed optimal for Adreno OpenCL
  • Full agent loop verified end-to-end on device: tools injected → model emits tool_calls (incl. parallel) → tool result returned → natural language summary
  • Key finding: qwen2.5-0.5b cannot emit tool_calls at this size; qwen3-0.6b is the minimum viable model for agentic loops

Changes (4 commits)

  • bdff9b0 feat(local-ai): add model scanner, sandbox prefix, installer and controller scaffolding
  • ca2a992 feat(local-ai): wire settings UI, app singletons and Local AI entry route
  • df0c0fc fix(local-ai): fix asset name, model bind and proot tmp to get Start running
  • 6a3a2b1 fix(local-ai): restore AppModule runtime DI bindings dropped by mistake

Known limitations

  • Draft: in-app end-to-end UI flow pending (server-level verified)
  • Model auto-start after reboot not implemented; imported model delete not implemented

ymz added 4 commits October 21, 2026 17:50
…roller scaffolding

Introduce the core building blocks for an embedded llama-server (OpenCL) local
AI experience:
- LocalAiModel/LocalAiModelScanner discovers .gguf models on device storage
- LocalAiProotCommand builds the sandbox prefix binding /vendor and /apex so
  the bionic-linked llama-server can reach the Adreno OpenCL driver and linker
- LocalAiInstaller unpacks the llama-oc payload into the rootfs
- LocalAiController owns the process lifecycle (start/stop/health) and exposes
  a state flow for the settings UI

Part of yuga-hashimoto#338 (local AI on device).
…running

- unpack llama-oc.tar (aapt2 gunzips the asset, no .gz name in apk)
- bind model parentFile into proot instead of the file itself
- add PROOT_TMP_DIR to the embedded proot environment
- add SAF multi-file import UI with empty-state and result labels
- scan extra external files dir for imported models
Local AI scaffolding never meant to remove the runtime/provider bindings
(VoskModelStore, LocalRuntimeInstaller, LocalRuntimeProcessLauncher, ...);
they are still referenced by AndCodeApplication and the runtime packages.
Also ignore the local proot/llama asset and local.properties backup.
@aixtin aixtin changed the title feat(local-ai): on-device local AI inference via llama.cpp (OpenCL) [WIP] feat(local-ai): on-device local AI inference via llama.cpp (OpenCL) Oct 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant