本文へ移動
cccskills
無料GitHub で公開

server-log-analyzer

Workflow for classifying AI Matrx server log lines in features/server-logs/log-rules.ts. Use when examining raw server logs, new [ModuleName] bracket tokens appear unclassified, log categories are wrong, or adding module recognition to the log viewer.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md7.6 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Server Log Analyzer

Analyzes raw logs from the AWS CloudWatch production services and the residual Coolify stream/scraper services, and keeps the parsing system in sync. CoolifyLogViewer.tsx is a legacy component name, not a statement that the primary server still runs on Coolify.

Two files to update

FilePurpose
features/server-logs/log-rules.tsParser, module map, categories, colors, regexes
components/admin/server-logs/CoolifyLogViewer.tsxCATEGORY_LABELS Record (display names)

Step 1 — Scan the logs

Read through the raw log sample. For each distinct [BracketToken] found, record:

[ModuleName]  →  dotted.module.path (if present)  →  pattern description

Example discovery table from production logs:

Bracket tokenModule pathPatternCategory
[ApiPrefixCompat]aidream.api.middleware.api_prefix_compatRewriting '/api/...' → '/...'compat
[AuthMiddleware]—Request/JWT accepted/rejectedauth
[Request]—METHOD /path: + JSON bodyrequest
[Stream Emitter]—Status Update / Data / Completion / End + JSONstream
[CHAT ROUTER]aidream.api.routers.chatconversation_id=...ai-execution
[Google Chat]—executing, with debug: ...ai-execution
[ToolRegistryV2]matrx_ai.tools.registryN requested tool(s) not foundai-execution
[AI Task]—Cache updated / Completionai-execution
[DEBUG EXECUTE UNTIL COMPLETE]matrx_ai.orchestrator.executorCurrent Debug Setting: + valueai-execution
[ConversationGate]—Auto-created / Ensured user_requestcx
[ConversationLabeler]—Labeled conversation ...cx
[CX PERSISTENCE PERSIST COMPLETED REQUEST]—Saved Conversation + IDscx
[UNRECOGNIZED]aidream.api.utils.field_warningsUnknown field 'x' (path=...)config
[uvicorn.access]—IP:PORT - "METHOD /path HTTP/1.1" STATUSsystem/request

Step 2 — Identify the echo pattern

Many of our logs currently emit two lines per event:

2026-04-03 20:28:52 [WARNING] [aidream.api.middleware.api_prefix_compat] [ApiPrefixCompat] Rewriting '/api/ai/chat' → '/ai/chat' — update ...
[ApiPrefixCompat] Rewriting '/api/ai/chat' → '/ai/chat' — update ...

The second line is the bare echo — no timestamp, no level, no module path. The parser handles these as UNKNOWN level standalone lines. Flag them in your report but do not strip them — they must pass through to raw untouched.


Step 3 — Update MODULE_CATEGORY_MAP in log-rules.ts

Add new entries to the map. Keys are the exact bracket token string (case-sensitive, including spaces):

const MODULE_CATEGORY_MAP: Record<string, LogCategory> = {
  // existing ...
  "CHAT ROUTER":    "ai-execution",
  "Google Chat":    "ai-execution",
  ToolRegistryV2:   "ai-execution",
  "AI Task":        "ai-execution",
  "DEBUG EXECUTE UNTIL COMPLETE": "ai-execution",
  ConversationGate:    "cx",
  ConversationLabeler: "cx",
  "CX PERSISTENCE PERSIST COMPLETED REQUEST": "cx",
  UNRECOGNIZED:     "config",
  UnifiedConfig:    "config",
};

Step 4 — Add new LogCategory values (if needed)

If you find patterns that don't fit existing categories, add them to:

  1. LogCategory type union in log-rules.ts
  2. ALL_CATEGORIES array in log-rules.ts
  3. categoryToColor() switch in log-rules.ts
  4. CATEGORY_LABELS Record in CoolifyLogViewer.tsx

Current categories and colors:

CategoryColorMeaning
requesttext-cyan-300HTTP request/response
streamtext-purple-300SSE / stream emitter
authtext-green-300JWT, session, fingerprint
compattext-amber-400API path rewriting
databasetext-teal-300DB queries
systemtext-neutral-400uvicorn, health, startup
errortext-red-400exceptions, tracebacks
ai-executiontext-violet-300model calls, tool registry, chat router
cxtext-sky-300conversation lifecycle, CX persistence
configtext-orange-300unrecognized fields, config warnings
json-payloadtext-neutral-500JSON continuation lines
generallevel coloreverything else

Step 5 — Update inferCategory() heuristics

For module names that appear without a module path (bare echo lines), add heuristic patterns:

// AI execution — bare echo lines with no module path
if (/\b(executing|tool.?registry|chat.?router|google.?chat)\b/i.test(raw)) return "ai-execution";
// CX lifecycle
if (/\b(conversation.?gate|conversation.?label|cx.?persist)\b/i.test(raw)) return "cx";
// Config / field validation
if (/\bUnrecognized\b|\bunknown.?field\b/i.test(raw)) return "config";

Step 6 — Verify regex for bracket names with spaces

The RE_MODULE_SHORT regex must allow spaces inside brackets:

// Handles: [ApiPrefixCompat], [CHAT ROUTER], [Stream Emitter],
//          [AI Task], [CX PERSISTENCE PERSIST COMPLETED REQUEST]
const RE_MODULE_SHORT = /^\[([A-Za-z][A-Za-z0-9_ ]*?)\]\s*/;

Step 7 — Produce the migration report

After updating the parser, produce a report for the Python backend team listing every pattern that should be standardized. Format:

## Log Migration Report — [date]

### Echo Pattern (HIGH PRIORITY)
Every log currently emits two lines — the structured line and a bare echo.
Fix: Remove the bare echo from all Python loggers.

Pattern to remove:
  [ModuleName] message text     ← no timestamp, no level

### Module Name Standardization

| Current bracket token | Recommended [ShortName] | Module path to add |
|---|---|---|
| [CHAT ROUTER] | [ChatRouter] | aidream.api.routers.chat |
| [DEBUG EXECUTE UNTIL COMPLETE] | [ExecutorDebug] | matrx_ai.orchestrator.executor |
| [CX PERSISTENCE PERSIST COMPLETED REQUEST] | [CxPersistence] | matrx_ai.cx.persistence |
| [UNRECOGNIZED] | [FieldValidator] | aidream.api.utils.field_warnings |
| [AI Task] | [AiTask] | matrx_ai.tasks (or current module) |
| [Google Chat] | [GoogleChat] | matrx_ai.providers.google |
| [ConversationGate] | [ConversationGate] | ✓ already CamelCase |
| [ConversationLabeler] | [ConversationLabeler] | ✓ already CamelCase |

### Required Log Format per Module

Replace:
  [CHAT ROUTER] conversation_id=86c092d0...

With:
  2026-04-03 20:28:52 [INFO] [aidream.api.routers.chat] [ChatRouter] conversation_id=86c092d0...

### JSON Payload Entries Without Headers
Some entries start directly with a JSON block (no header line ending in ':').
These should always be preceded by a header line:

  [ToolRegistryV2] 1 requested tool(s) not found:      ← add this
  {
      "missing_tools": [...]
  }

Quick reference — log format spec

TIMESTAMP [LEVEL] [module.path] [ShortName] MESSAGE
  • TIMESTAMP: 2026-04-03 20:28:52 (no sub-second required, but accepted)
  • [LEVEL]: [DEBUG] [INFO] [WARNING] [ERROR] [CRITICAL]
  • [module.path]: lowercase dotted Python path, e.g. [aidream.api.routers.chat]
  • [ShortName]: CamelCase, no spaces, max ~20 chars, e.g. [ChatRouter]
  • MESSAGE: ends with : if a JSON block follows on the next line

For JSON payloads, the block must immediately follow the header with no blank line between.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Admin debug system wiring for the floating AdminIndicator's live debug data and Copy Full Context. Use when adding debug visibility to a route or feature, wiring useDebugContext or the debug panel, capturing console errors, or enabling the copy-context workflow for a page.

日本語の概要は準備中です。原文の説明を表示しています。

armanisadeghi/ai-matrx32026年10月12日 更新

Compact two-icon Copy / Copy-for-AI controls (components/agent-copy). Use when adding copy buttons to a row, card, list, or record; merging duplicate Copy/JSON/AI controls; continuing the copy rollout; or writing a Copy-for-AI payload. NOT for markdown content actions (use rich-document-actions).

日本語の概要は準備中です。原文の説明を表示しています。

armanisadeghi/ai-matrx32026年10月12日 更新

Disclosing a surface's existing fixed AI jobs in the shell's top Agents menu. Use when a page, panel, overlay, or window already runs a mandate behind a button, assist, automatic action, or mode; when the agent-disclosure guard names a file; or during a surface check.

日本語の概要は準備中です。原文の説明を表示しています。

armanisadeghi/ai-matrx32026年10月12日 更新

The watch-fix-rerun method for making an existing platform agent or automated process efficient and correct: baseline its ledger, run one unit yourself, fix the class behind every wasted call, rerun, record. Use when asked to improve, optimize, watch, or 'make efficient' an agent, a sandbox session, a sync job, or any recurring automated process.

日本語の概要は準備中です。原文の説明を表示しています。

armanisadeghi/ai-matrx32026年10月12日 更新

Redux state for agent execution and firing agent shortcuts. Use when editing features/agents/redux/, building agent UI, creating a conversation, touching assembleRequest or NDJSON stream state, wiring agent-state selectors, adding a per-conversation capability, or triggering a shortcut from a button, menu, or code (useShortcutTrigger, launchAgentExecution).

日本語の概要は準備中です。原文の説明を表示しています。

armanisadeghi/ai-matrx32026年10月12日 更新

The provision for a call site: the exhaustive menu of values that place in the code can realistically produce. Use before creating or fixing a mandate or agent that reasons about more than its own input, when deciding whether an agent can answer at all with what it is sent, or when its output 'looks right' but nobody checked it could be. NOT for building the agent (use create-agent).

日本語の概要は準備中です。原文の説明を表示しています。

armanisadeghi/ai-matrx32026年10月12日 更新

armanisadeghi のスキルをすべて見る

このスキルの問題を報告する