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
AI-driven iOS experimentation & QA workbench for TrollStore — Swift + SwiftUI + SwiftPM, runs on iOS 15+ under TrollStore, ships 45 registered tools, 100+ subcommands, all callable by AI through natural language.
Zero-learning mode: just say it in plain words ("analyze how this app works", "is this plugin safe", "capture this app's traffic") — the AI picks the tools, installs dependencies, does the job, and gives you a one-line human answer.
TrollAgent is an AI-driven workbench for the TrollStore ecosystem: it wraps iOS injection, app analysis, decryption, traffic capture, cross-app UI control, device spoofing and more into a set of native tools callable by AI through natural language, plus an always-on floating AI voice companion (HUD) over any app.
Background & motivation
The iOS reverse-engineering / TrollStore ecosystem historically demanded deep expertise: which tool, which flag, which signing identity, which container path. TrollAgent removes that barrier — the AI drives every tool through a unified chat interface.
Previous generations of iOS automation stacks (iSH emulation, dual-track Alpine routing) were slow, crash-prone and duplicated. TrollAgent moved to a single unified Linux userspace (TrollRuntime) and is converging on fully native aarch64 execution (see Roadmap).
Device Environment — all-green self-check on non-jailbroken TrollStore (iOS 16.3)
AI in Action — one sentence, full pipeline
Request — "Run a few commands." AI plans a read-only check
Execution — 4 shell tools run automatically (pwd / date / uname / ls)
Result — human-readable answer with Alpine TrollRuntime context
Requirements & compatibility
Requirement
Note
iOS 15+
Runs under TrollStore 2 (jailbreak-friendly)
TrollStore 2.x
Install via .tipa; keep TrollStore updated — older builds re-sign with outdated ldid and can fail on large/complex bundles (e.g. ldid returned non-zero on install)
iOS 16+ — Developer Mode
TrollAgent ships debugger entitlements (get-task-allow / task_for_pid-allow) for injection & process control — iOS 16+ requires Developer Mode enabled (Settings → Privacy & Security → Developer Mode → enable → restart). TrollStore usually arms it automatically and prompts for a restart; a missing restart is the most common cause of a launch crash
iOS 17 non-jailbroken note
On iOS 17 non-jailbroken TrollStore, writing into other apps' containers and unsigned-dylib injection are restricted by the platform (CoreTrust trust-level change vs iOS 16). Core tools, VPN tunnel and silent install still work; for full capability on iOS 17, jailbreak (Dopamine) is required
Quick Start
Install
Build from CI (recommended): every push to main triggers GitHub Actions which produces TrollAgent.tipa (artifact name TrollAgent).
Or build locally on macOS: bash scripts/build-ipa.sh.
app duplicate → silent duplicate via trollstorehelper
Model & API key: configured in Settings → Model. Multiple upstream providers supported. The HUD voice loop shares the same configuration via App Group.
Independent agent runs with own queue & UI (A/B/C/D aliases); per-call requestTimeoutOverride (fast-fail budget); each sub-agent owns an independent session; fail-path invalidation prevents cross-contamination
Session store
SessionStore, conversations.* tools (list / status / history)
Conversation index & per-session status; per-stream isolated sessions; background handoff (handoffActiveRequestToBackground) when the app goes to background
User says "Run a few commands." in plain language (zero-learning mode)
2
Protocol check
OpenAIClient verifies the upstream protocol; auto-correct fixes any mismatch along the L0-L5 chain and persists the result; streamUnsupported memory skips wasted streaming attempts
3
Stream
SSE request starts (60s first-byte budget for main chat); each request owns an isolated session
4
Tool selection
Model returns tool calls; kernel batches & dispatches through the registry
Tool result fed back to the model as context; rounds 3-6 repeat until the model emits a final answer
7
Render
Final answer + tool cards rendered; completion sound; session invalidated on close / failure
Key design decisions
Single registry: every tool registered in one place (MCPCore.swift); default whitelist means new users are productive immediately.
Unified execution env: iSH retired; all shell commands run in TrollRuntime (Asbestos interpreter, full Alpine rootfs + apk ecosystem). No dual-track routing since v6.6.0.
JIT double-ensure: ptrace self-attach (silent) + unconditional TrollStore URL (apple-magnifier://enable-jit); waits 3s before the first shell command.
TrollStore mechanics: bundled setuid root toolchain; silent install via trollstorehelper; TCC entitlements passthrough (mic / speech recognition without prompts).
HUD separate process: ch.xxtou.hudapp independent binary embedded as a sub-package; App Group shared config; voice loop runs fully on-device.
Tool batching (v7.1.99-103): read-only/query tools batch up to 4 (executed sequentially, results visible to subsequent calls); state-changing/write tools run one at a time — with dual-layer safety (classification whitelist + dangerous-command interception in ShellTool).
Progressive disclosure: only core tools (shell.exec / control.screenshot) are always resident; the rest are revealed on demand to keep the model context lean.
Technology Stack
Dimension
Detail
Languages
Swift (main app / tools / AI kernel), Objective-C++ (HUD window), C (CHev/CISH/CLaunch/CMitm bridge components)
UI
SwiftUI (iOS 15+), full Simplified-Chinese / English bilingual switching (including HUD bubble lines)
Platform
iOS 15+ / TrollStore (jailbreak-friendly)
Dependency mgmt
SwiftPM
Runtime env
TrollRuntime unified Linux userspace (Asbestos interpreter + Alpine toolchain); roadmap target: aarch64 Linux ELF running directly
UI tree model: UIView subviews recursion (frame / class / text); roadmap: mixed mode — add in-process AX reads (view.accessibilityElements / UIAccessibilityCopyElementAtPoint) for semantic roles, so the tree "understands" the screen like a human (Android-accessibility / Mika-style)
🏗️ Build & engineering
tool.install: unified tool install loop — one-click in the unified environment (apk→pip→CI; CI cross-compiles native iOS binaries best-effort)
Long-term goal (see GOALS.md): full nativization — abolish the iSH/Alpine dual-track routing, ultimately run aarch64 Linux ELF directly so the AI perceives a single environment.
Phase
Status
Notes
P1 Unified userspace
✅ done
TrollRuntime (Asbestos interpreter) took over; iSH emulation retired
UIView subviews recursion (full frame/class) + in-process AX reads (view.accessibilityElements / UIAccessibilityCopyElementAtPoint) for semantic roles — the tree "understands" the screen like a human, Android-accessibility / Mika-style
v6.5.0 — core switch to rcarmo/ios-linuxkit Asbestos (ARM64 kernel of iSH); v7.0.3+ JIT enabled (-Djit=true + jit-fallback patch), v7.0.4+ ptrace self-enabled JIT (PT_ATTACHEXC keep-attach, TrollStore-style, no URL flash): full Alpine rootfs + apk ecosystem + full dynamic ELF support, device-verified.
v6.6.0 (fix1-9) — unified environment landed: CELF / elf-runner / static busybox / iSH routing all retired; shell.exec has no runtime param — all commands default to TrollRuntime; iOS-specific commands auto-handled natively; rootfs completed; native-chip tools cleared (lua/node/r2/cstool/llvm family — Alpine replaces them); CI 25-45 min faster.
Key decision (2026-10-17→10-23): the busybox static-ELF route (emu.c/CELF) retired — composed commands' final form = P5 ELF runtime (Linux shell semantics for free); self-written Swift shell unnecessary; fork verified to hang on native iOS (python3 subprocess NO JSON).
Recent milestones (7.1.x)
Version
What landed
7.1.88-90
HUD voice-loop polish: wall-climb guard fix (speech no longer stuck), back-to-idle after playback (audioPlayerDidFinishPlaying), bunny-girl sitting pose asset fallback (<prefix>_chin_sit)
7.1.91-92
UI fixes: app icons fill rounded corners (scaledToFill + clipShape), device-spoofing target picker (full AppPickerView with search/category/A-Z index)
7.1.93-97
Performance & navigation: removed HUD diag log real-time reads, model-manager jump fixes (delayed push → in-sheet NavigationLink), saveAndTest → lightweight connectivity test, upstream-model fetch in the model picker, update-install now jumps to TrollStore (main-thread fix)
7.1.98
Usage-stats token display: real usage captured in OpenAIClient, per-request "≈N tok" rendering
7.1.99-103
Tool batching for throughput: read-only batch ≤4, interpreter batching with script blacklist, audit fixes for env/curl/kill/sed — double-layer safety (classification + dangerous-command interception)
7.1.266-275
Deep audit — 11 logic fixes shipped in one release: pluggable closed-loop, tool-failure isError false-kill, SSL auto-retry, URL force-unwrap ×3, APPEND / UPDATE-FAIL fallbacks, completion-sound timing, token accounting precision, zip cross-session pollution, sub-agent SSL no-op, closure self. compile fix
7.1.276-277
Rendering fixes (list/quote wrapping truncation, table max-height removed) + protocol dead-loop root fix (auto-correct result persisted back to shared config — no more per-request L0 reset)
The workflow bumps CFBundleShortVersionString (+1, commit [skip ci]), so the artifact version is always the submitted version + 1.
CI accepts RELEASE_VERSION to auto-inject the release version (fixes version drift).
Artifacts: TrollAgent zip containing TrollAgent.tipa (~163 MB). The latest release tag is overwritten on every build.
QA guards run in CI: verify_ipa.py (IPA structure), check_tool_registration.py (registry consistency), brace checks.
Versioning convention
Support/Info.plist → CFBundleShortVersionString; bump per feature batch.
Commit convention: 7.1.x: <what landed>. Docs-only changes carry their own message.
Development Guide
Getting started
Open the repo in Xcode (SwiftPM layout under Sources/TrollMCP2/).
Signing: TrollStore signing handled by build scripts (ldid -S with Support/TrollAgent.entitlements); no developer account needed.
HUD is a separate source tree (HUD/, Objective-C++ floating-window framework) integrated in-app (standalone process route retired).
Code conventions
Tools are registered once in MCPCore.swift; new tools must also land in the default whitelist if meant to be available out of the box.
High-priority tools return unified error_code / reason / next_step; never return a misleading success.
Keep the unified environment in mind: shell commands run in TrollRuntime (Alpine), not on iOS natively — iOS-specific needs go through dedicated tools.
check_tool_registration.py / brace checks must pass before push.
Common pitfalls
Version drift: always let the workflow bump, or pass RELEASE_VERSION explicitly.
HUD config is per-process: read/write model config via App Group group.com.ai.iosxcode, not plain UserDefaults.
.waitingForConnectivity (not .waiting) is the correct URLSession readiness value.
Credits
Built with & thanks to these open-source projects and authors (mirrors the in-app About → Open Source Credits):