agentleFS
claude-worldclaude-world/claude-world-studio/CLAUDE.md

claude-world-studio

CLAUDE.md71 starsChanged 8 months agoMITView on GitHub

Content pipeline app: trend discovery, deep research, social publishing — with agentic memory, goals, and strategy (v2.2).

  • Reads credentials

The file

We split this CLAUDE.md into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Quality gate consistency: every publish entry point (REST /api/publish, /batch, MCP tool, scheduler) must enforce settings.minOverallScore …

    line 42
  2. Very specific:

    Test isolation: set STUDIO_USER_DATA_PATH to a mkdtemp dir before dynamically importing any DB-touching module (static imports hoist above …

    line 45
  3. Distinctive:

    Credentials from DB: All tokens and API keys are stored in SQLite DB and loaded automatically by Studio MCP tools.

    line 69
  4. Distinctive:

    Timeout safety: All MCP tool calls have timeouts to prevent hanging sessions.

    line 71

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

Claude World Studio

Content pipeline app: trend discovery, deep research, social publishing — with agentic memory, goals, and strategy (v2.2).

Architecture

  • server/ — Express + WebSocket server, Claude Agent SDK integration
  • server/services/ — Scheduler, social publisher, Studio MCP tools
  • server/services/memory-service.ts — Long-term memory store (SQLite FTS5); singleton memoryService
  • server/services/agent-orchestrator.ts — Goal state machine (PLAN→EXECUTE→REFLECT→COMPLETE); singleton orchestrator
  • server/services/strategy-agent.ts — Analytics-driven content strategy; singleton strategyAgent
  • server/routes/agent.ts — REST API for goals, memories, reflections, workflows, matrix-run
  • server/cleanup-registry.ts — Centralized cleanup (pattern from Claude Code)
  • client/ — React 19 + Tailwind UI (Vite build)
  • client/components/AgentDashboard.tsx — Goals/Workflows/Memory/Strategy dashboard page
  • client/hooks/ — useApi (typed fetch), useLanguage (context)
  • electron/ — Electron desktop wrapper
  • scripts/ — Build/test tooling (electron-build.cjs, desktop-smoke.cjs, ensure-native-abi.cjs) plus dev-only threads_api.py; nothing here runs at server runtime
  • .claude/skills/ — Skill definitions for Claude Code

Agentic Subsystem (v2.2)

DB Tables

TablePurpose
agent_goalsPersistent goal tracking — status, progress, sub-tasks JSON
agent_memoriesLong-term knowledge store — FTS5 indexed, type-tagged
agent_memories_ftsFTS5 virtual table — kept in sync via DB triggers
agent_reflectionsPer-session self-evaluation records
agent_workflowsReusable prompt template library

Key Patterns

  • searchMemoriesStmtCache (db.ts) — bounded Map (max 8 SQL variants) caches dynamic FTS5 statements
  • evictionScheduled flag (OrchestratorGoalRun) — prevents duplicate 10-min eviction timers
  • Yield-point guard in executeStateMachine — checks run.state after every await so abort/pause isn't overridden
  • markStaleGoalsFailed() on orchestrator startup — reconciles orphaned active goals from previous server runs
  • getMemoriesByType() store method — DB-level WHERE memory_type = ? filter; never fetch-then-filter in JS
  • NULL-binding trap: WHERE (account_id = ? OR account_id IS NULL) with a NULL bind collapses to global-only rows. When a filter param is undefined, use a dedicated no-filter statement (see getContextMemoriesAllAccounts, getMemoriesByType)
  • One-time migrations: guard with a settings-table flag (e.g. migration_publish_score_backfill) — never write data backfills that re-run on every boot
  • Quality gate consistency: every publish entry point (REST /api/publish, /batch, MCP tool, scheduler) must enforce settings.minOverallScore (70 fallback); scheduled tasks additionally raise the gate to max(setting, task.min_score) via createStudioMcpServer({minScore}). Gates raise, never lower
  • Never ship the data directory or .env via electron-builder files/extraResources — the live dev DB holds real tokens; this leaked credentials in v1.3.0–v2.0.0 releases
  • scripts/ensure-native-abi.cjs (pre dev/test/start + postinstall) — auto-rebuilds better-sqlite3 when electron:build leaves an Electron-ABI binary behind
  • Test isolation: set STUDIO_USER_DATA_PATH to a mkdtemp dir before dynamically importing any DB-touching module (static imports hoist above the env assignment)

Known Limitations

  • Goal pause/resume/abort works only for runs launched via orchestrator.runGoal (matrix-run); goals created by POST /api/agent/goals or the create_goal_session MCP tool return 409 (no in-memory run) and terminate via markStaleGoalsFailed on restart
  • agent_memories_fts is external-content FTS5 keyed on the implicit rowid of a TEXT-PK table — running VACUUM may renumber rowids and desync the index. No code runs VACUUM; don't add one without rebuilding the FTS index afterwards

MCP Tools (all 8)

ToolPurpose
publish_to_threadsPublish post (quality gate enforced)
get_publish_historyFetch recent publish records
upload_imageUpload workspace image (path traversal protected)
create_goal_sessionCreate agent_goals record
run_reflection_loopSave reflection → improvement memory
search_memoryFTS5 search with goalId/accountId/type filters
generate_strategy_from_analyticsInline analytics strategy (number[] hours)
run_strategy_agentFull StrategyAgent pipeline with calendar

Key Design Rules

  1. No Python runtime dependencies: Publishing uses native TypeScript fetch(), not Python scripts. The threads_api.py is a dev-only tool, not used by the server.
  2. Workspace containment: The AI agent operates within the session workspace only. Never reference ~/Downloads or paths outside workspace in prompts or examples. Use relative paths like downloads/card.pdf.
  3. Credentials from DB: All tokens and API keys are stored in SQLite DB and loaded automatically by Studio MCP tools. Never search the filesystem for credentials.
  4. MCP-first publishing: Publishing goes through the publish_to_threads Studio MCP tool, which reads tokens from DB. No direct API calls from the agent. The system prompt's embedded SKILL.md is for content strategy only — all execution uses MCP tools.
  5. Timeout safety: All MCP tool calls have timeouts to prevent hanging sessions.
  6. Programmatic quality gates: The publish_to_threads MCP tool enforces score >= minOverallScore from settings. The agent cannot bypass this via prompt manipulation.
  7. Cleanup registry: Modules register cleanup functions via registerCleanup(). Shutdown runs all cleanups in parallel. Sessions auto-register on creation and unregister on close.
  8. Typed SDK output: Agent output stream uses SDKOutputMessage discriminated union (not any). Defined in server/cli-session.ts.
  9. Error diagnostics: Logger keeps a 100-entry ring buffer. GET /api/diagnostics/errors exposes it. Client ErrorBoundary reports to POST /api/diagnostics/errors.

Dev Commands

npm run dev              # Start dev server + Vite
npm run build            # Build client
npm run typecheck        # TypeScript check
npm run electron:dev     # Electron dev mode
npm run electron:build   # Production .dmg

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.