llm-loop
Versatile Almost Local, Eventually Reasonable Assistant π«
Install / Use
npx skills add vakovalskii/NeuralDeskAppInstalls into whichever agent you are using.
Cursor Rules
Cursor IDE rules (v2)
Quality Score
Category
AI & Machine LearningSupported Platforms
Our assessment of llm-loop
llm-loop scores 67/100 on our quality scale, 890th of 941 AI & Machine Learning skills we index.
Its Cursor Rules is 6.2 KB long, well organised into 15 sections with 10 code examples: a thorough specification that gives an agent plenty to work with.
It has no GitHub stars yet, so there is no community track record; judge it on its content.
Maintenance, license and trust
- The repository was last updated about 5 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
- Our last check on 2026-10-19 found the source still online.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 78/100, with 2 cautions from licensing, adoption, age or documentation. These come from repository metadata, not a code audit β read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-24. Automated pattern scan on 2026-09-24. It catches known dangerous patterns, not every risk β read a skill before letting an agent act on it.
llm-loop compared with similar skills
All 4 of these similar skills score higher than llm-loop; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| llm-loop (this skill)by vakovalskii | 67 | 0 | 5mo ago | Cursor Rules |
| claude-memby thedotmack | 100 | 102.4k | today | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 87.8k | today | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 77.6k | today | CLAUDE.md |
| CowAgentby zhayujie | 100 | 47.5k | today | CLAUDE.md |
Frequently asked questions
- How do I install llm-loop?
- Run
npx skills add vakovalskii/NeuralDeskApp. The install tabs above show the steps for each supported agent. - Which AI agents does llm-loop work with?
- It is written for Cursor, as a Cursor Rules file. Other agents that read the same format can often use it too.
- Is llm-loop safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 78/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is llm-loop still maintained?
- The repository was last updated about 5 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
Skill content
View source on GitHubLLM Agent Loop
Overview
The agent loop in runner-openai.ts implements a ReAct-style agent that can:
- Receive user messages
- Stream LLM responses
- Execute tools
- Continue until task completion
Loop Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Agent Loop β
β β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β Build βββββΊβ Call βββββΊβ Stream β β
β β Messages β β LLM β β Response β β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β² β β
β β βΌ β
β β ββββββββββββ β
β β No β Tool β β
β ββββββββββββββββββββββββββ Calls? β β
β ββββββββββββ β
β β Yes β
β βΌ β
β ββββββββββββ β
β β Execute β β
β β Tools β β
β ββββββββββββ β
β β β
β βΌ β
β ββββββββββββ β
β β Add β β
β β Results βββββββ
β ββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
Key Components
Message Array
OpenAI chat format:
type ChatMessage = {
role: 'system' | 'user' | 'assistant' | 'tool';
content: string | ContentPart[];
tool_calls?: ToolCall[]; // Only for assistant
tool_call_id?: string; // Only for tool
name?: string; // Tool name for tool messages
};
Streaming
Uses OpenAI SDK streaming with requestAnimationFrame throttling:
const stream = await client.chat.completions.create({
model: modelName,
messages: messages,
tools: activeTools,
stream: true,
stream_options: { include_usage: true }
});
for await (const chunk of stream) {
// Process delta content
if (chunk.choices[0]?.delta?.content) {
sendStreamEvent(chunk.choices[0].delta.content);
}
// Accumulate tool calls
if (chunk.choices[0]?.delta?.tool_calls) {
accumulateToolCalls(chunk.choices[0].delta.tool_calls);
}
}
Tool Execution Flow
// 1. Check permission mode
const permissionMode = settings?.permissionMode || 'ask';
if (permissionMode === 'ask') {
// 2. Send permission request to UI
sendPermissionRequest(toolUseId, toolName, toolArgs);
// 3. Wait for user response
const approved = await waitForPermission(toolUseId);
if (!approved) continue;
}
// 4. Execute tool
const result = await toolExecutor.executeTool(toolName, toolArgs, {
sessionId: session.id,
onTodosChanged: (todos) => {
// Persist and notify UI
}
});
// 5. Add result to messages
messages.push({
role: 'tool',
tool_call_id: toolCall.id,
name: toolName,
content: result.success ? result.output : `Error: ${result.error}`
});
Loop Detection
Prevents infinite loops when model repeatedly calls same tool:
const LOOP_THRESHOLD = 5; // Same tool N times = loop
const MAX_LOOP_RETRIES = 5; // Max attempts to break loop
// Track recent tool calls
recentToolCalls.push({ name: toolName, args: argsString });
// Check for loops
if (recentToolCalls.length >= LOOP_THRESHOLD) {
const lastCalls = recentToolCalls.slice(-LOOP_THRESHOLD);
const allSameTool = lastCalls.every(c => c.name === lastCalls[0].name);
if (allSameTool) {
loopRetryCount++;
if (loopRetryCount >= MAX_LOOP_RETRIES) {
// Stop with error
sendLoopError(toolName);
return;
}
// Add hint to help model break loop
messages.push({
role: 'user',
content: 'β οΈ You are stuck in a loop. Try a different approach.'
});
}
}
Error Handling
Retryable Errors
Network errors are automatically retried:
const isRetryableNetworkError = (error: unknown): boolean => {
const code = error.cause?.code;
const status = error.status;
// Retry on socket errors
if (['ECONNRESET', 'ETIMEDOUT', 'ECONNREFUSED'].includes(code)) {
return true;
}
// Retry on server errors
if ([429, 500, 502, 503, 504].includes(status)) {
return true;
}
return false;
};
Retry Logic
const MAX_STREAM_RETRIES = 3;
const RETRY_BASE_DELAY_MS = 500;
for (let attempt = 0; attempt <= MAX_STREAM_RETRIES; attempt++) {
try {
return await streamResponse();
} catch (error) {
if (!isRetryableNetworkError(error) || attempt === MAX_STREAM_RETRIES) {
throw error;
}
const delayMs = RETRY_BASE_DELAY_MS * 2 ** attempt;
await sleep(delayMs);
}
}
Session Logging
Each turn is logged to ~/.localdesk/logs/sessions/{sessionId}/:
turn-001-request.json # Full request (messages, tools, params)
turn-001-response.json # Full response (content, tool_calls, usage)
turn-002-request.json
turn-002-response.json
...
Token Tracking
Accumulated across all iterations:
if (streamMetadata.usage) {
totalInputTokens += streamMetadata.usage.prompt_tokens || 0;
totalOutputTokens += streamMetadata.usage.completion_tokens || 0;
}
// Final report
sendMessage('result', {
usage: {
input_tokens: totaβ¦[redacted],
output_tokens: totaβ¦[redacted]
}
});
Abort Handling
User can stop generation at any point:
let aborted = false;
return {
abort: () => {
aborted = true;
console.log('[OpenAI Runner] Aborted');
}
};
// Check in loop
while (!aborted && iterationCount < MAX_ITERATIONS) {
// ... streaming
if (aborted) break;
// ... tool execution
if (aborted) break;
}
Configuration
| Setting | Default | Description |
|---------|---------|-------------|
| MAX_ITERATIONS | 50 | Max agent loop cycles |
| REQUEST_TIMEOUT_MS | 5 min | LLM request timeout |
| MAX_STREAM_RETRIES | 3 | Network error retries |
| LOOP_THRESHOLD | 5 | Tool calls to detect loop |
Related Skills
claude-mem
102.4kPersistent Context Across Sessions for Every Agent β Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Understand-Anything
87.8kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
headroom
77.6kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
CowAgent
47.5kOpen-source personal AI assistant & Agent Harness. Plans tasks, runs tools and skills, self-evolves with memory and knowledge. Multi-agent, multi-model, multi-channel. Lightweight, extensible, one-line install.
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit β see the Safety scan above for what the skill file itself contains.
