Skip to main content
Craft Agents provides inbox and archive views to help you focus on active work while preserving completed sessions for reference. The system uses status categories and flags to automatically organize your sessions.

Inbox vs Archive

Inbox

Sessions with open status category (todo, in-progress, needs-review)

Archive

Sessions with closed status category (done, cancelled)
The inbox/archive distinction is automatic based on your session status. Change a session’s status to move it between views.

Status Categories

Each status in your workspace has a category that determines its inbox/archive behavior:

Open Category (Inbox)

Statuses that represent active work:
  • Backlog - Not yet planned
  • Todo - Ready to work on
  • Needs Review - Attention required

Closed Category (Archive)

Statuses that represent completed or terminated work:
  • Done - Completed successfully
  • Cancelled - Terminated or abandoned
Custom statuses inherit their inbox/archive behavior from the category you choose when creating them. Plan your status categories carefully.

Flagging Sessions

Flags are independent of statuses - you can flag any session in any status to mark it for quick access:
1

Flag a Session

Mark important sessions for easy filtering
await flagSession(workspaceRootPath, sessionId);
2

View Flagged Sessions

List all flagged sessions (excludes archived)
const flagged = listFlaggedSessions(workspaceRootPath);
3

Unflag When Done

Remove the flag once you’re finished
await unflagSession(workspaceRootPath, sessionId);

Code Example

packages/shared/src/sessions/storage.ts
/**
 * List flagged sessions (excludes archived)
 */
export function listFlaggedSessions(
  workspaceRootPath: string
): SessionMetadata[] {
  return listActiveSessions(workspaceRootPath).filter(
    s => s.isFlagged === true
  );
}

/**
 * Flag a session
 */
export async function flagSession(
  workspaceRootPath: string,
  sessionId: string
): Promise<void> {
  await updateSessionMetadata(workspaceRootPath, sessionId, {
    isFlagged: true
  });
}

Archive Operations

Sessions can be explicitly archived, which removes them from all standard views:

Archive

await archiveSession(
  workspaceRootPath,
  sessionId
);

Unarchive

await unarchiveSession(
  workspaceRootPath,
  sessionId
);

Archive Metadata

Archived sessions track additional metadata:
packages/shared/src/sessions/types.ts
export interface SessionConfig {
  // ... other fields ...
  
  /** Whether this session is archived */
  isArchived?: boolean;
  
  /** Timestamp when session was archived (for retention policy) */
  archivedAt?: number;
}
Archiving a session hides it from inbox, completed, and flagged lists. It only appears in listArchivedSessions().

Retention Policy

Craft Agents can automatically delete old archived sessions:
packages/shared/src/sessions/storage.ts
/**
 * Delete archived sessions older than the specified number of days
 * Returns the number of sessions deleted
 */
export function deleteOldArchivedSessions(
  workspaceRootPath: string,
  retentionDays: number
): number {
  const cutoffTime = Date.now() - (retentionDays * 24 * 60 * 60 * 1000);
  const archivedSessions = listArchivedSessions(workspaceRootPath);
  let deletedCount = 0;

  for (const session of archivedSessions) {
    const archiveTime = session.archivedAt ?? session.lastUsedAt;
    if (archiveTime < cutoffTime) {
      if (deleteSession(workspaceRootPath, session.id)) {
        deletedCount++;
      }
    }
  }

  return deletedCount;
}
Deleted sessions cannot be recovered. Ensure your retention policy allows enough time for reference before deletion.

Workflow Patterns

Pattern 1: Status-Based Organization

1

New Sessions Start as Todo

All new sessions default to ‘todo’ status (inbox)
2

Update Status as Work Progresses

Change to ‘in-progress’, ‘needs-review’ as needed (stays in inbox)
3

Mark Done When Complete

Set to ‘done’ status (moves to archive)
4

Archive Old Completed Work

Explicitly archive sessions older than 30 days

Pattern 2: Flag-Based Quick Access

1

Flag Current Sprint Work

Mark 3-5 sessions you’re actively working on
2

Filter to Flagged View

Focus only on flagged sessions during work sessions
3

Unflag When Context Switching

Remove flags when switching to different projects

Pattern 3: Label + Status Combination

1

Apply Labels for Classification

Add labels like “bug”, “feature”, “documentation”
2

Use Status for State

Track progress with todo → in-progress → done
3

Filter by Label + Inbox

View only inbox sessions with “bug” label

Session Filtering

Available Filter Functions

packages/shared/src/sessions/storage.ts
// All non-archived sessions
const active = listActiveSessions(workspaceRootPath);

// Sessions with open status (inbox)
const inbox = listInboxSessions(workspaceRootPath);

// Sessions with closed status (archive)
const completed = listCompletedSessions(workspaceRootPath);

// Flagged sessions (excludes archived)
const flagged = listFlaggedSessions(workspaceRootPath);

// Archived sessions only
const archived = listArchivedSessions(workspaceRootPath);

Custom Filtering

You can combine filters for advanced queries:
import { listActiveSessions } from '@craft-agent/shared/sessions';

// Flagged inbox sessions with a specific label
const filtered = listActiveSessions(workspaceRootPath)
  .filter(s => s.isFlagged === true)
  .filter(s => {
    const category = getStatusCategory(workspaceRootPath, s.sessionStatus || 'todo');
    return category === 'open';
  })
  .filter(s => s.labels?.includes('bug'));

UI Workflows

Typical user interactions in the Craft Agents SaaS:
Default Landing Page
  • Shows all sessions with open status category
  • Sorted by lastMessageAt (most recent first)
  • Displays status badge, labels, and unread indicator
  • Quick actions: Change status, flag, archive

Unread Tracking

Sessions track unread state for real-time collaboration:
packages/shared/src/sessions/types.ts
export interface SessionConfig {
  /** ID of last message user has read */
  lastReadMessageId?: string;
  
  /**
   * Explicit unread flag - single source of truth for NEW badge.
   * Set to true when assistant message completes while user is NOT viewing.
   * Set to false when user views the session (and not processing).
   */
  hasUnread?: boolean;
}
The hasUnread flag is the single source of truth for displaying “NEW” badges in session lists.

Best Practices

1

Use Statuses for Workflow State

Map your team’s workflow to custom statuses (backlog → todo → in-progress → done)
2

Use Flags for Temporary Focus

Flag the 3-5 sessions you’re actively working on this week
3

Use Labels for Classification

Apply labels like “bug”, “feature”, “priority::1” for long-term organization
4

Archive Regularly

Keep your inbox clean by archiving completed work monthly
5

Set Retention Policies

Configure automatic deletion of archived sessions older than 90 days

Next Steps

Status System

Learn about customizable session statuses

Labels

Organize sessions with hierarchical labels

Build docs developers (and LLMs) love