Skip to content

feat: Update lattice prompt to include ticket workflow and plan mode integration #3

@gmoon

Description

@gmoon

Summary

Update lattice prompt to output a more comprehensive CLAUDE.md snippet that includes the full ticket workflow, plan mode integration, and execution order constraints.

Motivation

The current lattice prompt output covers basic CLI reference and "when working on features" guidance, but it's missing the structured workflows that make lattice most effective when an LLM agent is working tickets autonomously:

  1. Ticket workflow — When an agent is asked to work a ticket, it should assess lattice impact, comment on the ticket with planned changes, execute in strict order (lattice first → code → record), and close with a lattice summary
  2. Plan mode integration — Every plan should include a mandatory "Lattice Impact" section
  3. Execution order — Lattice updates must happen before code, implementations recorded after, drift checked before closing
  4. File access restriction — Agents must use the CLI only, never read/write .lattice/ directly

Proposed Output

The lattice prompt command should generate a snippet similar to the one below (adapted per-project based on existing lattice config):

## Lattice Integration (Mandatory)

This project uses [Lattice](https://github.com/forkzero/lattice) for requirements tracking. The `.lattice/` directory contains the knowledge graph.

**NEVER read or write `.lattice/` files directly. ALL lattice operations MUST use the `lattice` CLI.**

### Quick Reference

\`\`\`bash
lattice summary              # Status overview
lattice list requirements    # All requirements
lattice list requirements --status unresolved  # Open work
lattice get REQ-XXX-001      # Full details
lattice plan                 # What to work on next
lattice drift                # Check for version drift
lattice search "query"       # Search nodes
lattice lint                 # Lint for issues
lattice diff --since main    # Changes on this branch
\`\`\`

### Node Types

| Type | Purpose | ID Pattern |
|------|---------|------------|
| Source | Research/references | `SRC-XXX` |
| Thesis | Strategic claims | `THX-XXX` |
| Requirement | Specifications | `REQ-XXX-NNN` |
| Implementation | Code bindings | `IMP-XXX-NNN` |

### Resolution States

- `verified` — Implemented and tested
- `blocked` — Waiting on dependency
- `deferred` — Postponed to later milestone
- `wontfix` — Rejected/out of scope

### Working Tickets

When asked to work on a ticket (GitHub issue, etc.), follow this workflow:

**1. Assess** — Before any code, evaluate the ticket against the lattice:
   - Run `lattice summary` and `lattice plan` to understand current state
   - Determine if the ticket requires new or modified **requirements**, **theses**, or **sources**
   - Identify if additional research is needed (new sources)
   - Flag any existing requirements that will be affected

**2. Comment on the ticket** — Add a comment to the ticket listing:
   - Planned new requirements, theses, and sources
   - Existing lattice nodes that will be affected
   - Any research gaps that need to be filled

**3. Execute (strict order)**:
   1. **Lattice first** — Use the lattice CLI to create/update requirements, theses, and sources BEFORE writing any code
   2. **Code second** — Implement the feature or fix
   3. **Record & verify last** — Record implementations and run drift detection

**4. Close the ticket** — Include a lattice summary in the closing comment:
   - Use `lattice diff --since main` to show what changed
   - List all added/modified/resolved lattice nodes
   - Confirm `lattice drift` reports no unresolved drift

### Plan Mode Workflow

When entering plan mode, every plan MUST include a **Lattice Impact** section:

1. Run `lattice summary` and `lattice plan` to understand current state
2. Evaluate whether the planned work requires new or modified requirements, theses, or sources
3. Identify if additional research is needed
4. Flag any existing requirements that will be affected
5. List all lattice changes as part of the plan output for user review

### Recording Implementations

After completing coding tasks:

\`\`\`bash
lattice add implementation --id IMP-XXX-NNN --requires REQ-XXX-NNN \
  --bind "file:function" --status pass
lattice resolve REQ-XXX-NNN verified
lattice drift
\`\`\`

A task is NOT complete until `lattice drift` reports no unresolved drift for affected requirements. Reference requirements in commits: `Implements REQ-XXX-001`.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions