Skip to content

feat: named agents, session resumption, and Slack bot#22

Merged
maxigimenez merged 10 commits into
mainfrom
feat/named-agents-memory-sessions-slack
May 21, 2026
Merged

feat: named agents, session resumption, and Slack bot#22
maxigimenez merged 10 commits into
mainfrom
feat/named-agents-memory-sessions-slack

Conversation

@maxigimenez
Copy link
Copy Markdown
Owner

@maxigimenez maxigimenez commented May 14, 2026

Summary

  • Named agents with system prompts — define reusable AgentDefinition entries in parallax.yml; route tickets to specific agents using agentLabels (ticket label → agent name); each agent can have an optional systemPrompt prepended to every prompt
  • Session ID tracking & --resume — Claude Code session_id captured from system:init stream events, persisted to the DB, and passed as --resume <id> on retry to continue interrupted work
  • Slack bot (@parallax/slack) — Bolt Socket Mode bot (no public URL needed); posts plan approval messages with Approve/Reject buttons, sends task event notifications (PR created, failed, canceled), and handles /parallax slash commands (retry, cancel, status, pr-review)

Running locally

1. Install and build

pnpm install
pnpm build

2. Update parallax.yml with the new top-level structure

# Agent definitions (optional)
- agents:
    - name: developer
      provider: claude-code
      model: claude-opus-4-5
      systemPrompt: "You are a senior backend engineer..."

# Slack config (optional)
- slack:
    botToken: xoxb-...       # Bot User OAuth Token
    appToken: xapp-...       # App-Level Token (Socket Mode)
    channel: "#ai-tasks"

# Projects — unchanged format
- id: my-repo
  workspaceDir: /path/to/repo
  agent:
    name: developer          # references agents[].name
  agentLabels:
    ai-frontend: reviewer    # ticket label → agent name
  pullFrom:
    provider: github
    filters:
      owner: myorg
      repo: my-repo
      labels: [ai-ready]

Existing single-project parallax.yml files with agent.provider work unchanged.

3. Set up the Slack bot (optional)

See docs/slack-bot.md for the full step-by-step:

  1. Create a Slack App at api.slack.com/apps
  2. Enable Socket Mode and generate an App-Level Token (xapp-)
  3. Add OAuth scopes: chat:write, commands, channels:history, groups:history
  4. Install the app to your workspace and copy the Bot Token (xoxb-)
  5. Create a /parallax slash command
  6. Add botToken and appToken to the slack: section in your parallax.yml

4. Start

pnpm parallax register ./parallax.yml
pnpm parallax start

Test plan

  • pnpm install && pnpm build completes without errors across all packages
  • pnpm test — all new and updated test cases pass (config-loader, provider-services, claude-code adapter, github-service, linear-service, slack formatters)
  • Register a config with named agents and agentLabels; create a GitHub issue with a matching label and verify agentName is set on the task
  • Verify --resume flag appears in task logs when retrying a task that has a stored agentSessionId
  • Configure the Slack section; restart the orchestrator; confirm the bot connects with no errors; trigger a task and verify a plan approval message appears with Approve/Reject buttons

🤖 Generated with Claude Code

Introduces four related capabilities:

- Named agents with system prompts: define reusable agent personalities
  in parallax.yml; route tickets to specific agents via agentLabels
- Agent memory: persist per-agent markdown files under
  ~/.parallax/agents/<name>/memory.md; prepended to every prompt
- Session ID tracking and --resume: capture Claude Code session IDs
  from system:init events; pass --resume on retry to continue
  interrupted work
- Slack bot (@parallax/slack): Bolt Socket Mode bot for plan
  approval/rejection, task event notifications, and /parallax slash
  commands (retry, cancel, status, pr-review)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
parallax Skipped Skipped May 14, 2026 9:20am

Agent memory is not needed — each project already has its own markdown
files that provide context to the agent.

Removes agent-memory.ts, its test, the docs section, and the
buildContextPrefix memory injection in BaseAgentAdapter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@maxigimenez maxigimenez changed the title feat: named agents, agent memory, session resumption, and Slack bot feat: named agents, session resumption, and Slack bot May 14, 2026
- Auto-fix prettier formatting in packages/slack (curly braces, line wrapping)
- Auto-fix prettier formatting in packages/orchestrator
- Remove unused parseLogs function and LOG_LEVEL/LogLevel imports from config-loader
- Remove unused Task import from linear/service
- Remove unused AppConfig import from index
- Rename config param to _config in resolveAgentNameForTask (not referenced)
- Add varsIgnorePattern: '^_' to shared ESLint config to allow _prefixed destructuring

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix Block/KnownBlock import: move from @slack/bolt to @slack/web-api
- Add .js extension to relative import in formatters.test.ts (NodeNext moduleResolution)
- Add @parallax/slack path alias to tsconfig.base.json so orchestrator can type-check the dynamic import
- Update slack package.json exports to ./dist/slack/src/index.js to match actual tsc output structure (baseUrl at monorepo root widens rootDir when cross-package path aliases are resolved)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Wrap bot initialization in try/catch and log on failure
- Log successful connection with channel name
- Replace .catch(() => {}) on all notify() calls with error logging

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…in API

- Sanitize botToken/appToken to '***' in /config API response (security)
- Config sidebar: add Agents section listing name/provider/model per agent
- Config sidebar: add Slack section showing the configured channel
- Task details: add 'Slack channel' chip when Slack is configured

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eation on agent self-commits

Slack formatting:
- Convert plan markdown to Slack mrkdwn (## headers → *bold*, **text** → *text*, links)
- Remove triple-backtick code fence wrapping that was showing raw markdown symbols

Plan approval buttons:
- Replace original message (replace_original: true) after Approve/Reject instead of
  appending a thread reply — buttons are removed and a confirmation line is shown

GitHub PR creation:
- Fix commitAndPush to check for commits ahead of origin/main rather than only checking
  for uncommitted working-tree changes; this handles the case where the agent commits
  its own changes, leaving a clean working tree but unpushed commits
- Sanitize branch names derived from externalId: replace '#' and spaces with '-' so
  GitHub issue refs like 'owner/repo#123' produce valid branch names

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Failure notifications:
- persistPlanResult now sends 'failed' notification when plan generation fails
- processTask critical-error catch block now sends 'failed' notification
  (previously these two paths failed silently with no Slack message)

Plan approval message:
- Remove description (too noisy)
- Replace fields array with single section text block
- Project shown on first line, task on second line

Tests: add 'project before task' and 'no description' assertions; remove
stale 'section fields' label from test name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…detection failure

When the local worktree branch contains characters like '#' (from GitHub
externalIds like owner/repo#123), gh pr create cannot reliably detect
the push remote via tracking config. Pass --head <branchName> explicitly
so gh resolves the head ref directly from the sanitized remote branch name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@maxigimenez maxigimenez marked this pull request as ready for review May 21, 2026 14:05
@maxigimenez maxigimenez merged commit 12f5d67 into main May 21, 2026
3 checks passed
@maxigimenez maxigimenez deleted the feat/named-agents-memory-sessions-slack branch May 21, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant