返回 Skill 列表
extension
分类: 开发与工程无需 API Key

queue-based-flow

在代理运行时将提示堆叠在队列中,以最小化上下文切换来实现每天持续输出6k行代码并保持流状态。适用于大量编码会话、迭代改进、快速迭代周期或持续生产力。队列支持异步执行而不阻塞。触发词包括“流状态”、“队列提示”、“大量编码”、“持续输出”、“最小化中断”。

person作者: jakexiaohubgithub

Queue-Based Flow State

Purpose

Stack prompts in queue while agent executes, minimizing context switches to achieve sustained 6k lines/day output.

When to Use

  • Heavy coding sessions
  • Iterative refinements
  • Flow state preservation
  • Rapid iteration cycles
  • High-productivity sessions

Core Instructions

Queue Pattern

from asyncio import Queue
import asyncio

class PromptQueue:
    def __init__(self):
        self.queue = Queue()
        self.running = False

    async def add_prompt(self, prompt):
        """Add prompt to queue"""
        await self.queue.put(prompt)
        if not self.running:
            await self.process_queue()

    async def process_queue(self):
        """Process queued prompts"""
        self.running = True

        while not self.queue.empty():
            prompt = await self.queue.get()
            await self.execute_async(prompt)
            self.queue.task_done()

        self.running = False

    async def execute_async(self, prompt):
        """Execute prompt asynchronously"""
        result = await agent.execute(prompt)
        return result

Usage Example

queue = PromptQueue()

# User rapidly adds prompts without waiting
await queue.add_prompt("Fix bug in auth.py")
await queue.add_prompt("Add tests for new feature")
await queue.add_prompt("Refactor database layer")
await queue.add_prompt("Update documentation")

# All execute in sequence without context switches
# User maintains flow state

Performance

  • 6k lines/day sustained output
  • Minimized context switching
  • Preserved flow state
  • Async execution

Version

v1.0.0 (2025-10-23)