SkilVaultSign inStart free

Catalogue / feature-task-graph

feature-task-graph

Older skill: source not recordedSignedTracks feature subtasks from local JSON records with validated dependency graphs, readiness, parallel candidates, blocked reasons and evidence-backed completion. Use for project task breakdowns and progress inspection. Not for autonomous delegation, unsupported schema migration, or marking work comp…
---
name: feature-task-graph
description: >-
  Tracks feature subtasks from local JSON records with validated dependency graphs,
  readiness, parallel candidates, blocked reasons and evidence-backed completion.
  Use for project task breakdowns and progress inspection. Not for autonomous
  delegation, unsupported schema migration, or marking work complete without its
  acceptance evidence.
---

Treat task records as a graph and an evidence trail

A feature contains an objective, exit criteria and ordered subtask records. A subtask is eligible only when its explicit dependencies are complete. An explicit blocked state differs from waiting for dependencies. Parallel eligibility identifies candidates; shared files, resources and contracts can still make simultaneous execution unsafe. The CLI below never starts workers or performs implementation work.

Confirmation

Inspect supplied task records and approved local references within the requested scope. An explicit request authorizes its exact action. Obtain confirmation before additional record/file creation or changes, completion updates, migrations, archival/moves/deletions, worker delegation, subprocess execution or external sharing. Completion must name the task, acceptance evidence and summary; a successful tool exit alone does not establish the feature's exit criteria. Do not ask again for an isolated action already explicitly authorized.

Use an explicit project root

  • Select the approved repository root rather than inferring it from a nested package or a symlink.
  • Task records use the familiar .tmp/tasks/FEATURE/task.json plus subtask_NN.json layout; completed/FEATURE can hold separately approved archived records.
  • The helper operates on active directories and excludes completed; it never moves or deletes work automatically.
  • Do not depend on an installed router or a specific agent name — any authorized planner can prepare the same JSON records after reviewing task scope.

Record fields

| Record | Fields | |---|---| | Feature | id, name, status (active/completed/blocked/archived), objective, context_files, optional reference_files, exit_criteria, counts, created_at, nullable completed_at | | Subtask | id, two-digit seq, title, status (pending/in_progress/completed/blocked), depends_on, Boolean parallel, context/reference files, nonempty acceptance criteria and deliverables, nullable agent_id, optional suggested_agent, start/completion timestamps, completion summary |

Context files carry governing guidance; reference files point at existing implementation examples. Actual files must exist and be approved to read — recording a path is not a read or execution authorization.

A worked example

Feature archive-import:

  • Task 01 validates a record format
  • Task 02 implements a parser, depends on 01
  • Task 03 writes independently scoped documentation, depends on 01

Tasks 02 and 03 are parallel candidates only if their ownership and resources do not overlap. After the parser completes, record a specific summary such as "Rejects malformed dates and preserves source IDs; isolated parser checks pass." Never reuse a generic "done", and never mark a downstream task complete while dependencies are pending.

Confirmation

  • Inspecting supplied task records and approved local references within the requested scope needs no extra permission; an explicit request authorizes its exact action.
  • Confirm before: record or file creation/changes, completion updates, migrations, archival, moves, deletions, worker delegation, subprocess execution, or external sharing.
  • Completion must name the task, its acceptance evidence and a summary; a successful tool exit alone does not establish the feature's exit criteria.
  • Do not re-ask about an isolated action already explicitly authorized.

Complete standalone Python CLI

The standard-library implementation below replaces routing/runtime dependencies. Save the block only to an approved new file and run installed Python. Read commands are status, next, parallel, deps, blocked, validate, context, and contracts; only complete writes, requiring an approved action flag and acceptance-evidence acknowledgment. It uses atomic replacement per JSON file and a feature-local exclusive lock. A crash between subtask and feature writes can leave a stale cached count; validation detects it and read commands refuse the invalid inventory until an approved repair reconciles the count. For valid inventories, status derives progress from actual subtasks. There is no two-file transaction claim.

import argparse
import json
import os
import re
import uuid
from collections import Counter
from datetime import datetime, timezone
from pathlib import Path

FEATURE_STATES = {'active', 'completed', 'blocked', 'archived'}
SUBTASK_STATES = {'pending', 'in_progress', 'completed', 'blocked'}
FEATURE_REQUIRED = {'id', 'name', 'status', 'objective', 'context_files', 'exit_criteria',
                    'subtask_count', 'completed_count', 'created_at', 'completed_at'}
SUBTASK_REQUIRED = {'id', 'seq', 'title', 'status', 'depends_on', 'parallel', 'context_files',
                    'acceptance_criteria', 'deliverables', 'agent_id', 'started_at',
                    'completed_at', 'completion_summary'}

def strings(value): return isinstance(value, list) and all(isinstance(x, str) for x in value)

def atomic_json(path, data):
    temporary = path.with_name(path.name + '.' + uuid.uuid4().hex + '.tmp')
    try:
        with temporary.open('x', encoding='utf-8') as stream:
            json.dump(data, stream, indent=2); stream.write('\n')
            stream.flush(); os.fsync(stream.fileno())
        os.replace(temporary, path)
    finally:
        temporary.unlink(missing_ok=True)

class Tasks:
    def __init__(self, root):
        self.root = Path(root).resolve(strict=True)
        self.base = self.root / '.tmp' / 'tasks'
        if self.base.exists() and (self.base.is_symlink() or not self.base.is_dir()):
            raise ValueError('Task root must be an ordinary directory')
    def directory(self, feature):
        if not re.fullmatch(r'[a-z0-9]+(?:-[a-z0-9]+)*', feature) or feature == 'completed':
            raise ValueError('Invalid feature slug')
        path = self.base / feature
        if path.is_symlink() or not path.is_dir(): raise ValueError('Feature not found or unsafe')
        if self.root not in path.resolve().parents: raise ValueError('Feature escapes root')
        return path
    def features(self, feature=None):
        if feature: self.directory(feature); return [feature]
        if not self.base.exists(): return []
        return sorted(p.name for p in self.base.iterdir()
                      if p.is_dir() and not p.is_symlink() and p.name != 'completed')
    def load(self, feature):
        folder = self.directory(feature)
        paths = [folder / 'task.json'] + sorted(folder.glob('subtask_*.json'))
        records = []
        for path in paths:
            if path.is_symlink() or not path.is_file(): raise ValueError('Missing or unsafe record: ' + path.name)
            with path.open(encoding='utf-8') as stream: data = json.load(stream)
            if not isinstance(data, dict): raise ValueError('Record must be an object')
            records.append((path, data))
        return records[0][1], records[1:]
    def errors(self, feature):
        try: task, rows = self.load(feature)
        except (ValueError, OSError) as error: return [str(error)]
        errors = []
        missing = FEATURE_REQUIRED - task.keys()
        if missing: errors.append('Missing feature fields: ' + ', '.join(sorted(missing)))
        if task.get('id') != feature: errors.append('Feature ID differs from directory')
        if task.get('status') not in FEATURE_STATES: errors.append('Invalid feature status')
        for name in ('name', 'objective', 'created_at'):
            if not isinstance(task.get(name), str) or not task.get(name): errors.append('Invalid feature ' + name)
        for name in ('context_files', 'exit_criteria', 'reference_files'):
            if name in task and not strings(task[name]): errors.append('Invalid feature ' + name)
        if not task.get('exit_criteria'): errors.append('Feature has no exit criteria')
        for name in ('subtask_count', 'completed_count'):
            value = task.get(name)
            if isinstance(value, bool) or not isinstance(value, int) or value < 0: errors.append('Invalid ' + name)
        seqs = [data.get('seq') for _, data in rows]
        counts = Counter(str(seq) for seq in seqs)
        by_seq = {str(data.get('seq')): data for _, data in rows}
        for path, data in rows:
            seq = data.get('seq')
            missing = SUBTASK_REQUIRED - data.keys()
            if missing: errors.append(path.name + ' missing: ' + ', '.join(sorted(missing)))
            if not isinstance(seq, str) or not re.fullmatch(r'\d{2}', seq): errors.append(path.name + ': invalid sequence')
            elif path.name != 'subtask_' + seq + '.json': errors.append(path.name + ': filename/sequence mismatch')
            if counts[str(seq)] > 1: errors.append(path.name + ': duplicate sequence')
            if data.get('id') != feature + '-' + str(seq): errors.append(path.name + ': invalid ID')
            if data.get('status') not in SUBTASK_STATES: errors.append(path.name + ': invalid status')
            if not isinstance(data.get('title'), str) or not data.get('title'): errors.append(path.name + ': missing title')
            if not isinstance(data.get('parallel'), bool): errors.append(path.name + ': parallel must be Boolean')
            for field in ('depends_on', 'context_files', 'reference_files', 'acceptance_criteria', 'deliverables'):
                if field in data and not strings(data[field]): errors.append(path.name + ': invalid ' + field)
            for field in ('acceptance_criteria', 'deliverables'):
                if not data.get(field): errors.append(path.name + ': empty ' + field)
            dependencies = data.get('depends_on') if strings(data.get('depends_on')) else []
            for dep in dependencies:
                if dep not in by_seq: errors.append(str(seq) + ': missing dependency ' + dep)
                if dep == seq: errors.append(str(seq) + ': self dependency')
            if data.get('status') == 'completed' and (not data.get('completed_at') or not data.get('completion_summary')):
                errors.append(str(seq) + ': completion lacks timestamp/summary')
        visited, active = set(), set()
        def visit(seq):
            if seq in active: errors.append('Dependency cycle at ' + seq); return
            if seq in visited: return
            active.add(seq)
            deps = by_seq[seq].get('depends_on', [])
            for dep in deps if strings(deps) else []:
                if dep in by_seq: visit(dep)
            active.remove(seq); visited.add(seq)
        for seq in by_seq: visit(seq)
        completed = sum(data.get('status') == 'completed' for _, data in rows)
        if task.get('subtask_count') != len(rows): errors.append('Declared subtask count mismatch')
        if task.get('completed_count') != completed: errors.append('Cached completion count mismatch')
        return sorted(set(errors))
    def valid(self, feature):
        errors = self.errors(feature)
        if errors: raise ValueError('; '.join(errors))
        return self.load(feature)
    def inspect(self, command, feature, seq=None):
        task, rows = self.valid(feature)
        items = [data for _, data in rows]
        done = {s['seq'] for s in items if s['status'] == 'completed'}
        ready = [s for s in items if s['status'] == 'pending' and all(d in done for d in s['depends_on'])]
        if task['status'] != 'active': ready = []
        if command == 'status':
            counts = dict(Counter(s['status'] for s in items))

Preview shortened. The full SKILL.md is in the pack.