home / skills / codyswanngt / lisa / tasks-sync

tasks-sync skill

/.claude/skills/tasks-sync

This skill syncs your current session tasks to a project directory, ensuring persistence and automatic future updates.

npx playbooks add skill codyswanngt/lisa --skill tasks-sync

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.4 KB
---
name: tasks-sync
description: This skill should be used when syncing current session tasks to a project directory. It exports all tasks from the current Claude Code session to JSON files in the project's tasks directory, enabling persistence across sessions.
allowed-tools: ["Read", "Write", "Bash", "TaskList", "TaskGet"]
---

# Sync Tasks to Project

Sync all tasks from the current session to `projects/$ARGUMENTS/tasks/{session-id}/`.

This skill is for manual syncing when work started without setting an active project. Once synced, the automatic hook handles future task updates.

## Process

### Step 1: Validate Project

Check if the project directory exists:

```bash
ls -d projects/$ARGUMENTS 2>/dev/null
```

If the project doesn't exist, ask: "Project '$ARGUMENTS' doesn't exist. Create it?"

If yes, create the project structure:

```bash
mkdir -p projects/$ARGUMENTS/tasks
```

### Step 2: Determine Session ID

Find the current session by looking for the most recently modified task directory:

```bash
ls -dt ~/.claude/tasks/*/ 2>/dev/null | head -1 | xargs basename
```

If no session found, use a timestamp-based identifier:

```bash
echo "manual-$(date +%Y%m%d-%H%M%S)"
```

Store the session ID for use in subsequent steps.

### Step 3: Set Active Project

Create/update the active project marker:

```bash
echo "$ARGUMENTS" > .claude-active-project
```

### Step 4: Get Current Tasks

Use TaskList to get all tasks in the current session.

### Step 5: Sync Each Task

For each task from TaskList:

1. Use TaskGet to get full task details
2. Create the session directory:

```bash
mkdir -p projects/$ARGUMENTS/tasks/{session-id}
```

3. Create a JSON file with the task data:

```json
{
  "id": "<task-id>",
  "subject": "<subject>",
  "description": "<description>",
  "activeForm": "<activeForm>",
  "status": "<status>",
  "blocks": [],
  "blockedBy": []
}
```

4. Write to `projects/$ARGUMENTS/tasks/{session-id}/<id>.json`

### Step 6: Stage for Git

```bash
git add projects/$ARGUMENTS/tasks/{session-id}/*.json
```

### Step 7: Report

```
Synced X tasks to projects/$ARGUMENTS/tasks/{session-id}/
- Pending: Y
- In Progress: Z
- Completed: W

Files staged for commit. Run /git-commit when ready.
```

## Notes

- This skill manually syncs all current tasks to a project
- Use this when work started without a project context
- After syncing, the active project is set so future tasks auto-sync via the hook
- Each sync creates a new session directory to preserve history

Overview

This skill syncs all tasks from the current session into a project's tasks directory so work persists across sessions. It exports each task as a JSON file under projects/<project>/tasks/<session-id>/, sets the active project marker, and stages the files for git. Use it to capture work started outside an active project so future task updates auto-sync.

How this skill works

It validates or creates the target project directory, determines a session identifier (most-recent session or a timestamp-based manual id), and writes each task from the current session to its own JSON file in a new session folder. The skill updates the active project marker, stages the new files with git add, and reports counts by status.

When to use it

  • You began work without an active project and need to persist current session tasks.
  • You want to create a historic snapshot of all tasks for the current session.
  • You need to set the active project so future tasks auto-sync via the hook.
  • You are preparing task files to be committed to the project repository.

Best practices

  • Verify the target project name before syncing to avoid writing to the wrong directory.
  • Review staged JSON files before committing; run the provided git-commit command when ready.
  • Run this skill once per distinct session to preserve a clean session history.
  • Ensure TaskList and TaskGet permissions are available so full task details are exported.

Example use cases

  • Manually persist all open session tasks to a project after starting work in a generic session.
  • Create an auditable snapshot of tasks for handoff or retrospective review.
  • Bootstrap an active project marker so subsequent tasks are auto-synced by the hook.
  • Stage exported tasks for a review commit before merging into the project repository.

FAQ

What happens if the project does not exist?

You will be prompted to create it; if confirmed the required project/tasks directories are created automatically.

How is the session-id determined?

It uses the most recently modified local session directory when available, otherwise it makes a timestamp-based manual id.

Are existing task files overwritten?

Each sync creates a new session directory to preserve history, so existing session folders are not overwritten.