The open-source managed agents platform. Turn coding agents into real teammates — assign tasks, track progress, compound skills. https://multica.ai
Find a file
Jiayuan 5931e8f84e
feat(agent): add auto-backgrounding and process management (#17)
* feat(agent): add auto-backgrounding to exec tool

- Add yieldMs parameter to exec tool (default 5s) - commands that don't
  complete within this time automatically run in background
- Create shared process-registry.ts for unified process management
- Refactor process.ts to use shared registry
- Add --debug CLI flag for session message logging
- Signal isolation: backgrounded processes ignore abort signals

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(session): preserve tool_use/tool_result pairs during compaction

Previously, session compaction simply kept the last N messages, which
could break tool_use/tool_result pairs if the cut point fell between
them. This caused "tool_call_id is not found" errors from the API.

Now compaction finds a safe cut point that starts from either:
- A user message without tool_result
- An assistant message whose tool_use is needed by the next tool_result

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(session): use Kimi as default model for summary compaction

- Auto-detect MOONSHOT_API_KEY from environment
- Use moonshot-v1-128k (cheaper than k2-thinking)
- Fall back to tokens mode if API key not available

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add rule to never use git commit --amend

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: clarify git amend rule for immediate fixes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 04:22:42 +08:00
apps/web Add monorepo setup with Turborepo and Web client 2026-01-29 16:33:35 +08:00
packages/sdk Add monorepo setup with Turborepo and Web client 2026-01-29 16:33:35 +08:00
src feat(agent): add auto-backgrounding and process management (#17) 2026-01-30 04:22:42 +08:00
.dockerignore Add Docker support for Gateway and SDK documentation 2026-01-28 17:56:22 +08:00
.gitignore Initial project setup with multi-component architecture 2026-01-28 14:08:34 +08:00
CLAUDE.md feat(agent): add auto-backgrounding and process management (#17) 2026-01-30 04:22:42 +08:00
package.json feat(agent): add interactive CLI for agent interaction 2026-01-30 03:29:45 +08:00
pnpm-lock.yaml feat(agent): add exec/process tools 2026-01-30 01:52:10 +08:00
pnpm-workspace.yaml Add monorepo setup with Turborepo and Web client 2026-01-29 16:33:35 +08:00
README.md docs: enhance README with session management details 2026-01-30 03:12:57 +08:00
tsconfig.json Implement WebSocket Gateway with NestJS and client SDK 2026-01-28 16:46:51 +08:00
turbo.json Add monorepo setup with Turborepo and Web client 2026-01-29 16:33:35 +08:00

Super Multica

A multi-component architecture for distributed agent systems.

Project Structure

src/
├── agent/          # Agent module
│   ├── profile/    # Agent profile management
│   ├── session/    # Session persistence
│   └── tools/      # Agent tools (exec, process)
├── gateway/        # Gateway module
├── client/         # Client module
└── shared/         # Shared types and utilities

Getting Started

pnpm install
pnpm dev

Agent CLI

Use the agent module directly from the CLI for isolated testing.

# New sessions get a UUIDv7 ID (shown on start)
pnpm agent:cli "hello"
# [session: 019c0b0a-b111-765c-8bbd-f4149beac9c4]

# Continue a session
pnpm agent:cli --session 019c0b0a-b111-765c-8bbd-f4149beac9c4 "what did I say?"

# Or use a custom session name
pnpm agent:cli --session demo "remember my name is Alice"
pnpm agent:cli --session demo "what's my name?"

# Override provider/model
pnpm agent:cli --provider openai --model gpt-4o-mini "hi"

# Use an agent profile
pnpm agent:cli --profile my-agent "hello"

# Set thinking level
pnpm agent:cli --thinking high "solve this complex problem"

Sessions

Sessions persist conversation history to ~/.super-multica/sessions/<id>/. Each session includes:

  • session.jsonl - Message history in JSONL format
  • meta.json - Session metadata (provider, model, thinking level)

Sessions use UUIDv7 for IDs by default, providing time-ordered unique identifiers. The agent automatically handles context compaction when conversations grow too long.

Agent Profiles

Agent profiles define identity, personality, tools, and memory for an agent. Profiles are stored as markdown files in ~/.super-multica/agent-profiles/<id>/.

Profile CLI

# Create a new profile with default templates
pnpm agent:profile new my-agent

# List all profiles
pnpm agent:profile list

# Show profile contents
pnpm agent:profile show my-agent

# Open profile directory in file manager
pnpm agent:profile edit my-agent

Profile Structure

Each profile contains:

  • identity.md - Agent name and role
  • soul.md - Personality and behavioral constraints
  • tools.md - Tool usage instructions
  • memory.md - Persistent knowledge
  • bootstrap.md - Initial conversation context

Agent Tools

exec

Execute short-lived shell commands and return output.

exec({ command: "ls -la", cwd: "/path/to/dir", timeoutMs: 30000 })

process

Manage long-running background processes (servers, watchers, daemons). Output is buffered (up to 64KB) and terminated processes are automatically cleaned up after 1 hour.

# Start a background process (returns immediately with process ID)
process({ action: "start", command: "npm run dev" })

# Check process status
process({ action: "status", id: "<process-id>" })

# Read process output
process({ action: "output", id: "<process-id>" })

# Stop a process
process({ action: "stop", id: "<process-id>" })

# Clean up terminated processes
process({ action: "cleanup" })

Scripts

  • pnpm dev - Run in development mode
  • pnpm agent:cli - Run the agent CLI for module-level testing
  • pnpm agent:profile - Manage agent profiles
  • pnpm build - Build for production
  • pnpm start - Run production build
  • pnpm typecheck - Type check without emitting