Skip to content

perf(cli): make GitHub-backed commands fast #83

Open

Description

@FreshlyBrewedCode

Parent

#78

What to build

Commands stop paying repeatedly for work they have already done.

Every mutating command builds the map's full snapshot — which already carries every step together with its dependency edges — and then immediately re-reads each step's dependencies one request at a time. A single step complete on a thirty-step map costs roughly thirty-six requests, about thirty-one of them redundant. Reads have the same shape: map show lists the map's sub-issues twice and then walks every step individually, where one snapshot would answer the whole command.

Nothing survives process exit either. The response cache and the snapshot memo live for the lifetime of one process, and agents invoke the CLI once per command, so in practice nothing is ever reused. Measured against a map holding one step and one goal — effectively the floor — a local-only command runs in ~170ms while github-backed reads take 600ms to 1.4s, with no improvement across repeated invocations.

There is also no backoff anywhere in the write path. GitHub's burst limit is reached long before its hourly one, so an agent seeding a map with a few dozen steps trips it and every subsequent command fails hard until the window clears. The error message already tells the user wayful avoids rapid bursts; nothing implements that.

Finally, the sub-issue budget a map's steps and goals share is invisible until the moment it is exceeded.

Acceptance criteria

  • The number of requests wayful step complete makes does not grow with the number of steps on the map.
  • wayful map show costs no more requests than wayful map status for the same map.
  • A second wayful context against an unchanged project, in a fresh process, is measurably faster than the first.
  • A cache that outlives the process never serves stale data: a change made on GitHub is visible to the very next command.
  • A burst of wayful step create calls large enough to reach GitHub's secondary rate limit completes rather than failing, backing off as instructed.
  • wayful map status reports the map's sub-issue usage against its cap, and warns as it approaches it.
  • Creating a step past the cap still fails with the existing named error.
  • Behaviour under the filesystem backend is unchanged.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg:clitype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions