Loading...
Loading...
Visualize and manage Claude Code AI agents as pixel art characters in a VS Code extension office interface
npx skill4agent add aradotso/ai-agent-skills pixel-agents-vscodeSkill by ara.so — AI Agent Skills collection.
code --install-extension pablodelucca.pixel-agentsgit clone https://github.com/pablodelucca/pixel-agents.git
cd pixel-agents
npm install
cd webview-ui && npm install && cd ..
npm run build# Install Claude Code (if not already installed)
npm install -g @anthropic-ai/claude-code// Click "+ Agent" button in Pixel Agents panel
// This spawns a new Claude Code terminal with a character// Right-click "+ Agent" button
// Select "Launch with --dangerously-skip-permissions"
// Agent will bypass all tool approval prompts// 1. Click a character to select it
// 2. Click an empty seat to reassign the character// Click "Layout" button in Pixel Agents panelCtrl+ZCmd+ZCtrl+YCmd+YDelete// Click the ghost border outside current grid
// Grid expands up to 64×64 tiles// Toggle sound when agent finishes turn
// Settings → Enable Sound Notifications// Settings → Debug View
// Shows per-agent diagnostics:
// - JSONL file status
// - Lines parsed
// - Last data timestamp
// - File path// Settings → Export Layout (saves as JSON)
// Settings → Import Layout (load from JSON file)// Settings → Add Asset Directory
// Point to folder with custom furniture packswebview-ui/public/assets/assets/
├── furniture/
│ ├── desk-01/
│ │ ├── manifest.json
│ │ └── sprite.png
│ └── chair-01/
│ ├── manifest.json
│ └── sprite.png
├── floors/
│ └── tile-wood.png
└── walls/
└── brick/
├── manifest.json
└── tileset.png{
"id": "desk-modern",
"name": "Modern Desk",
"category": "desks",
"width": 2,
"height": 1,
"isSeat": true,
"seatOffset": { "x": 0, "y": -16 },
"rotationGroups": [
{
"rotations": ["north", "east", "south", "west"],
"sprite": "desk-modern.png"
}
],
"stateGroups": [
{
"state": "off",
"sprite": "desk-modern-off.png"
},
{
"state": "on",
"sprite": "desk-modern-on.png"
}
]
}# 1. Create folder in assets/furniture/
mkdir webview-ui/public/assets/furniture/desk-modern
# 2. Add sprite PNG and manifest.json
# 3. Rebuild extension
npm run build// 1. Create asset directory structure:
// /my-assets/
// furniture/
// custom-desk/
// manifest.json
// sprite.png
// 2. In Pixel Agents Settings → Add Asset Directory
// 3. Select /my-assets/
// 4. Assets appear in furniture picker{
"id": "custom-plant",
"name": "Custom Plant",
"category": "decorations",
"width": 1,
"height": 1,
"isSeat": false,
"rotationGroups": [
{
"rotations": ["north"],
"sprite": "plant.png"
}
]
}import * as vscode from 'vscode';
import * as fs from 'fs';
import * as path from 'path';
// Watch Claude Code JSONL transcript for agent activity
function watchAgentTranscript(projectPath: string, agentId: string): vscode.Disposable {
const jsonlPath = path.join(
projectPath,
'.claude',
'projects',
agentId,
'transcript.jsonl'
);
let lastPosition = 0;
const interval = setInterval(() => {
if (!fs.existsSync(jsonlPath)) {
return;
}
const stats = fs.statSync(jsonlPath);
if (stats.size <= lastPosition) {
return;
}
const buffer = Buffer.alloc(stats.size - lastPosition);
const fd = fs.openSync(jsonlPath, 'r');
fs.readSync(fd, buffer, 0, buffer.length, lastPosition);
fs.closeSync(fd);
const lines = buffer.toString('utf-8').split('\n').filter(l => l.trim());
lines.forEach(line => {
try {
const record = JSON.parse(line);
handleAgentRecord(agentId, record);
} catch (err) {
console.error('[Pixel Agents] Failed to parse JSONL:', err);
}
});
lastPosition = stats.size;
}, 500);
return new vscode.Disposable(() => clearInterval(interval));
}
function handleAgentRecord(agentId: string, record: any): void {
// Detect agent activity from JSONL record type
if (record.type === 'tool_use') {
const toolName = record.content?.name;
if (toolName === 'write_file' || toolName === 'edit_file') {
updateAgentState(agentId, 'typing');
} else if (toolName === 'search_files' || toolName === 'read_file') {
updateAgentState(agentId, 'reading');
} else if (toolName === 'run_command') {
updateAgentState(agentId, 'typing');
}
} else if (record.type === 'user_message') {
updateAgentState(agentId, 'idle');
}
}
function updateAgentState(agentId: string, state: string): void {
// Send message to webview
webviewPanel.webview.postMessage({
command: 'updateAgentState',
agentId,
state
});
}interface Character {
id: string;
x: number;
y: number;
targetX: number;
targetY: number;
state: 'idle' | 'walking' | 'typing' | 'reading';
direction: 'north' | 'south' | 'east' | 'west';
frame: number;
spriteSheet: HTMLImageElement;
}
class CharacterRenderer {
private characters: Map<string, Character> = new Map();
private readonly TILE_SIZE = 16;
private readonly FRAME_RATE = 8; // frames per second
private frameCounter = 0;
update(deltaTime: number): void {
this.frameCounter += deltaTime;
const frameInterval = 1000 / this.FRAME_RATE;
this.characters.forEach(char => {
// Update position if walking
if (char.state === 'walking') {
const dx = char.targetX - char.x;
const dy = char.targetY - char.y;
const distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 1) {
char.x = char.targetX;
char.y = char.targetY;
char.state = 'idle';
} else {
const speed = 2; // pixels per frame
char.x += (dx / distance) * speed;
char.y += (dy / distance) * speed;
// Update direction based on movement
if (Math.abs(dx) > Math.abs(dy)) {
char.direction = dx > 0 ? 'east' : 'west';
} else {
char.direction = dy > 0 ? 'south' : 'north';
}
}
}
// Advance animation frame
if (this.frameCounter >= frameInterval) {
char.frame = (char.frame + 1) % this.getFrameCount(char.state);
}
});
if (this.frameCounter >= frameInterval) {
this.frameCounter = 0;
}
}
render(ctx: CanvasRenderingContext2D): void {
this.characters.forEach(char => {
const spriteX = this.getSpriteX(char);
const spriteY = this.getSpriteY(char);
ctx.drawImage(
char.spriteSheet,
spriteX, spriteY,
this.TILE_SIZE, this.TILE_SIZE * 2, // source
Math.floor(char.x), Math.floor(char.y),
this.TILE_SIZE, this.TILE_SIZE * 2 // destination
);
});
}
private getSpriteX(char: Character): number {
return char.frame * this.TILE_SIZE;
}
private getSpriteY(char: Character): number {
const directionOffsets = {
'south': 0,
'west': 1,
'east': 2,
'north': 3
};
const stateOffsets = {
'idle': 0,
'walking': 0,
'typing': 4,
'reading': 8
};
return (stateOffsets[char.state] + directionOffsets[char.direction])
* this.TILE_SIZE * 2;
}
private getFrameCount(state: string): number {
if (state === 'walking') return 4;
if (state === 'typing' || state === 'reading') return 3;
return 1; // idle
}
moveCharacter(id: string, targetX: number, targetY: number): void {
const char = this.characters.get(id);
if (char) {
char.targetX = targetX;
char.targetY = targetY;
char.state = 'walking';
}
}
setCharacterState(id: string, state: Character['state']): void {
const char = this.characters.get(id);
if (char) {
char.state = state;
char.frame = 0;
}
}
}interface Point {
x: number;
y: number;
}
class Pathfinder {
private grid: boolean[][]; // true = walkable
private width: number;
private height: number;
constructor(width: number, height: number) {
this.width = width;
this.height = height;
this.grid = Array(height).fill(null).map(() => Array(width).fill(true));
}
setObstacle(x: number, y: number, blocked: boolean): void {
if (x >= 0 && x < this.width && y >= 0 && y < this.height) {
this.grid[y][x] = !blocked;
}
}
findPath(start: Point, end: Point): Point[] | null {
if (!this.isWalkable(end.x, end.y)) return null;
const queue: { point: Point; path: Point[] }[] = [
{ point: start, path: [start] }
];
const visited = new Set<string>();
visited.add(`${start.x},${start.y}`);
const directions = [
{ x: 0, y: -1 }, // north
{ x: 1, y: 0 }, // east
{ x: 0, y: 1 }, // south
{ x: -1, y: 0 } // west
];
while (queue.length > 0) {
const { point, path } = queue.shift()!;
if (point.x === end.x && point.y === end.y) {
return path;
}
for (const dir of directions) {
const next = { x: point.x + dir.x, y: point.y + dir.y };
const key = `${next.x},${next.y}`;
if (
this.isWalkable(next.x, next.y) &&
!visited.has(key)
) {
visited.add(key);
queue.push({
point: next,
path: [...path, next]
});
}
}
}
return null; // No path found
}
private isWalkable(x: number, y: number): boolean {
return (
x >= 0 &&
x < this.width &&
y >= 0 &&
y < this.height &&
this.grid[y][x]
);
}
}
// Usage
const pathfinder = new Pathfinder(32, 32);
// Mark furniture as obstacles
pathfinder.setObstacle(5, 5, true); // desk
pathfinder.setObstacle(6, 5, true); // desk continuation
// Find path from spawn to desk
const path = pathfinder.findPath({ x: 1, y: 1 }, { x: 5, y: 6 });
if (path) {
// Move character along path
path.forEach((point, index) => {
setTimeout(() => {
renderer.moveCharacter('agent-1', point.x * 16, point.y * 16);
}, index * 200);
});
}// Settings → Debug View (toggle on)
// Check per-agent diagnostics:
// - "JSONL not found" = extension can't locate session file
// - "Lines parsed: 0" = no activity detected
// - Verify file path matches expected location// If running from source (F5 Development Host):
// View → Debug Console
// Search for "[Pixel Agents]"
// Look for:
// - Project directory resolution errors
// - JSONL polling status
// - Path encoding mismatches# Check if file exists
ls ~/.claude/projects/*/transcript.jsonl// Check Debug Console for "Unrecognized JSONL record type: X"// 1. Close all Claude Code terminals
// 2. In Pixel Agents panel, click each character
// 3. Press Delete or click trash icon
// 4. Spawn fresh agent with "+ Agent"// 1. Type something in the Claude Code terminal
// 2. Wait 2-3 seconds for polling to update
// 3. If stuck, close and reopen Pixel Agents panel# Agent starts in home directory
code
# Sessions tracked under:
~/.claude/projects/<home-directory-hash>/# Always open VS Code with a folder
code /path/to/project// 1. Spawn multiple agents for parallel work
// Right-click "+ Agent" → create 3 agents
// 2. Assign each to different task
// Agent 1: "Refactor authentication module"
// Agent 2: "Write unit tests for API"
// Agent 3: "Update documentation"
// 3. Monitor all agents visually in office
// Watch characters move between typing/reading states
// 4. Intervene when speech bubble appears
// Click terminal to provide input or approval// 1. Design office layout per team structure
// Layout → Create 4 desk clusters for 4 teams
// 2. Export layout for sharing
// Settings → Export Layout → save as team-office.json
// 3. Team members import same layout
// Settings → Import Layout → select team-office.json
// 4. Everyone sees agents in same office structuretask// Parent agent spawns sub-agent
// Example: Main agent delegates "write tests" to sub-agent
// Visual behavior:
// - New character appears linked to parent
// - Sub-agent character animates independently
// - Both visible until sub-task completes
// - Sub-agent disappears when task done// 1. Create asset pack structure
mkdir -p /my-assets/furniture/custom-furniture
// 2. Add manifest and sprites
cat > /my-assets/furniture/custom-furniture/manifest.json << 'EOF'
{
"id": "gaming-chair",
"name": "Gaming Chair",
"category": "seats",
"width": 1,
"height": 1,
"isSeat": true,
"seatOffset": { "x": 0, "y": -8 },
"rotationGroups": [
{
"rotations": ["north", "south", "east", "west"],
"sprite": "chair.png"
}
]
}
EOF
// 3. Link in Pixel Agents
// Settings → Add Asset Directory → /my-assets
// 4. Use in layout editor
// Layout → Place → Select "Gaming Chair"// Open Pixel Agents panel
"pixelAgents.openPanel"
// Spawn new agent (normal)
"pixelAgents.spawnAgent"
// Spawn agent with skip permissions
"pixelAgents.spawnAgentSkipPermissions"
// Open layout editor
"pixelAgents.openLayoutEditor"
// Open settings modal
"pixelAgents.openSettings"
// Toggle debug view
"pixelAgents.toggleDebug"Ctrl+Shift+PCmd+Shift+P> Pixel Agents: Open Panel
> Pixel Agents: Spawn Agent