Članci s tagom #ai
-
MCP server architecture: building a remote HTTP MCP for AI tool use
How Shinobi serves MCP over streamable HTTP instead of stdio: one Node process with the dashboard and the /mcp and /mcp/home endpoints, SQLite on a Docker volume, a Cloudflare Tunnel in front, a static bearer token or OAuth for auth, modules that filter the tool list, and the long-lived jobs (plugin schedules, nightly backup, morning brief) that a stdio server could not run. Updated for Shinobi 0.12.1.
-
Dead end tracking: teaching AI agents to not repeat failed approaches
Shinobi records approaches that failed and why, so agents don't retry them. check_dead_ends searches them before new work (full-text and file overlap by default, semantic with an embedding provider), log_dead_end records a confirmed failure, update_dead_end retires one that no longer applies, and Claude Code hooks add matching dead ends to the agent's context on every prompt and edit. Updated for Shinobi 0.12.1.
-
Decision logging for AI agents: capturing rationale that survives 6 months
Shinobi's log_decision captures architecture, library, pattern and tradeoff decisions with their rationale when they are made. recall finds them later (full-text by default, semantic with an embedding provider), decisions_for_file shows what was decided about a file, update_decision_status moves a decision through its lifecycle, and extract_decisions drafts entries from a transcript. Updated for Shinobi 0.12.1.
-
Session resumability for AI agents: how task state survives context window limits
Four Shinobi MCP calls make an agent's work resumable after a context window overflow, a crash or a device switch: agent_bootstrap at the start, claim_task before a task, complete_task after it, and session_closeout at the end. What each call takes and returns in Shinobi 0.12.1.
-
Why I built a task management system specifically for AI agents
AI agents forget everything between sessions: context windows fill, sessions end, you switch machines. Shinobi is an open-source MCP server that keeps tasks, decisions and failed approaches outside the context window, with agent_bootstrap at the start of a session, claim_task and complete_task during it, session_closeout at the end, and dead ends checked before new work. Updated for Shinobi 0.12.1.
-
AI OCR for invoice drafts in PHP: extracting structured data from PDFs and images
OcrInvoiceDraftTool: VisionAnalyzer 3 input modes (local PDF→document block, local image→image block, remote URL→cURL download→image block), TaskRouter::TASK_VISION, max_tokens=512 temperature=0.0. Extraction prompt: partner, dates, line_items (description/qty/unit_price/vat_rate), totals — Croatian VAT 0/5/13/25, OIB 11 digits, EUR default. parseJsonStrict strips code fences. Draft-only safety: never writes to DB, status=draft, operator fiscalizes manually.
-
Building a personal AI assistant in PHP: voice notes, semantic memory, Telegram
LIMAlife: 7-phase personal AI (memory/reminders/HTTP → Gmail/Calendar → proactive intelligence → weekly brief → inbox autopilot → SocialScout). AES-256-GCM encrypted memories, ConversationContextEnricher (zero AI calls), EmailClassifier (Groq Llama FREE pre-filter), WeeklyFounderBriefJob (text+voice OGG), split per-source SocialScout jobs (HN/Reddit/X), ShinobiRecallClient grounding.
-
Multi-provider AI chat in PHP: tiered routing saves 80% of tokens
LIMAi: BYOK provider model (Anthropic/OpenAI/Groq/Gemini/Ollama), two-tier routing (Tier 1 keyword pre-routing zero tokens + Tier 2 KIK orchestrator for ambiguous), directChat fallback to TaskRouter::TASK_DRAFTS (Gemini Flash FREE), AITokenTracker unified tracking, ConversationModel per-user history, SSE streaming chat.
-
Circuit breaker for AI providers in PHP: OPEN/HALF_OPEN/CLOSED state machine
CircuitBreaker: CLOSED/OPEN/HALF_OPEN state machine, failureThreshold=3, transientRecoverySeconds=300 (5min), permanentRecoverySeconds=1800 (30min), DB-backed ai_provider_health (one indexed PK read/request). ProviderError: 6 categories — PERMANENT_BILLING vs RATE_LIMITED distinction (413 is TPM cap not billing, URL-stripped match, billing before 4xx/401 check). Retry-After honored. upsert avoids deprecated ON DUPLICATE KEY UPDATE.
-
Per-tenant AI usage tracking in PHP: attributing every LLM token to its tenant
Two tracking systems: ai_usage_daily (day-level aggregates for budget monitoring, composite PK on date+tenant+provider+model) and limai_token_usage (per-call rows with execution_id for agent log correlation). tenant_id is the required first parameter in every write path — silent attribution bugs aren't possible.
-
Multi-provider AI with automatic failover: how TaskRouter works in PHP
TaskRouter: 10 named task roles, failover chains (paid → FREE on failure), a stateful circuit breaker in ai_provider_health, 6 provider adapters, and zero vendor lock-in in application code. Every AI call is one method; the router handles the rest.
-
Building a unified BYOK AI provider: one interface for Claude, OpenAI, DeepSeek, Groq, Gemini, and Ollama
Six AI providers, four wire formats, one interface, and a runtime failover chain that flips paid Claude to free Gemini when the bill spikes. The pattern I'm shipping in every product I build.
-
Self-Optimizing PHP: catching P95 regression before it breaches your budget
APM tools show you a P95 regression dashboard. Self-Optimizing opens a GitHub PR to fix it. Mann-Kendall trend test + Cohen's d magnitude gate filter noise. The same 4-tap operator flow as Self-Healing — but for performance regressions, not broken code.
-
Self-Explaining PHP: AI triage before you open the log
Every production ERROR triggers a 3-bullet AI summary in Telegram: what happened, why probably, and exactly which file:line to look at first. The analysis arrives before you've opened the log. Cost: ~$0.0001. Latency: 30-60 seconds. No Sentry needed.
-
Self-Healing PHP: AI fixes production bugs in 4 phone taps
A production bug fires. Telegram pings my phone. I tap Analyze. Claude reads the repo and opens a PR. I review on my phone and tap Merge. The system deploys, verifies, and closes the incident. Total operator time: 30 seconds. On a $5/month shared host.