99 - Agentic AI Workflow for Neovim

repository·master·Indexed 26 days ago

https://github.com/theprimeagen/99

An agentic AI workflow for Neovim designed to augment programmers through 'search' and 'work' capabilities. It allows developers to navigate codebases using LLMs, replace code via visual selection, and manage persistent tasks using the Worker extension. Supports multiple AI CLI backends including OpenCodeProvider, ClaudeCodeProvider, CursorAgentProvider, and GeminiCLIProvider, with integration for nvim-cmp, blink.cmp, Telescope, and fzf-lua.

Tokens
2.2K
Snippets
7
Records
16
Agent score
39%

What's inside 99

  1. Use Completions for Contextual Prompting

    master

    When prompting, you can add context to your requests using specific symbols. This requires cmp to be configured with source = "cmp" in your completion settings.

    • #: References rules. Typing # in the prompt allows you to autocomplete rule files from your configured rule directories.
    • @: References files. Typing @ allows you to fuzzy-search project files to inject them into the AI context.
  2. Use Completions and Contextual References

    master

    When prompting, you can inject context into your request using specific symbols:

    • # references rules: Type # in the prompt to autocomplete rule files from your configured rule directories.
    • @ references files: Type @ to fuzzy-search project files (files in .gitignore are excluded).

    Integration with Completion Engines:

    • For nvim-cmp, set source = "cmp".
    • For blink.cmp, set source = "blink".
  3. Configure 99 AI Providers and Models

    master

    99 supports multiple AI CLI backends. You can switch the backend by setting the provider in the _99.setup function. If you do not specify a model, the provider's default model will be used.

    Supported Providers:

    • OpenCodeProvider (default): uses opencode CLI, default model opencode/claude-sonnet-4-5
    • ClaudeCodeProvider: uses claude CLI, default model claude-sonnet-4-5
    • CursorAgentProvider: uses cursor-agent CLI, default model sonnet-4.5
    • GeminiCLIProvider: uses gemini CLI, default model auto
    _99.setup({
        provider = _99.Providers.ClaudeCodeProvider,
        -- model is optional, overrides the provider's default
        model = "claude-sonnet-4-5",
    })
  4. Install and Basic Setup for 99

    master

    To use 99 in Neovim, add it to your plugin manager and call require("99").setup() with an options object.

    Key configuration options include:

    • logger: Configure logging level and path. Use _99.DEBUG for debugging.
    • tmp_dir: Set the temporary directory (e.g., ./tmp). Note that if this is outside your current working directory, tools like claude code or opencode may have permission issues.
    • completion: Configure autocomplete settings, including source ("native", "cmp", or "blink"), custom_rules (a list of directories containing SKILL.md files), and files discovery settings.
    • md_files: A list of markdown files (e.g., "AGENT.md") to automatically add to the prompt based on the project root.
    • provider: Specify the AI provider (defaults to OpenCodeProvider).
    {
        "ThePrimeagen/99",
        config = function()
            local _99 = require("99")
            local cwd = vim.uv.cwd()
            local basename = vim.fs.basename(cwd)
    
            _99.setup({
                logger = {
                    level = _99.DEBUG,
                    path = "/tmp/" .. basename .. ".99.debug",
                    print_on_error = true,
                },
                tmp_dir = "./tmp",
                completion = {
                    custom_rules = {
                        "scratch/custom_rules/",
                    },
                    source = "native",
                },
                md_files = {
                    "AGENT.md",
                },
            })
        end
    },
  5. Configure AI Providers and Models

    master

    99 supports multiple AI CLI backends. You can switch providers using the provider option in the _99.setup function. If model is not specified, the provider's default model will be used.

    Supported Providers:

    • OpenCodeProvider (default): Uses opencode CLI. Default model: opencode/claude-sonnet-4-5.
    • ClaudeCodeProvider: Uses claude CLI. Default model: claude-sonnet-4-5.
    • CursorAgentProvider: Uses cursor-agent CLI. Default model: sonnet-4.5.
    • GeminiCLIProvider: Uses gemini CLI. Default model: auto.
    _99.setup({
        provider = _99.Providers.ClaudeCodeProvider,
        -- model is optional, overrides the provider's default
        model = "claude-sonnet-4-5",
    })
  6. Retrieve Debug Logs for Bug Reporting

    master

    To report a bug, you must provide the full running debug logs. You can retrieve the logs from the last run by executing the following command in Neovim:

    :lua require("99").view_logs()

    Warning: Before sharing logs, ensure you delete any query printing that might contain secrets or sensitive information.

  7. View Debug Logs for Troubleshooting

    master

    To report a bug, you must provide the full running debug logs. You can retrieve the logs from the last run by executing the following command in Neovim:

    :lua require("99").view_logs()

    Warning: Before sharing logs, ensure you remove any secrets or sensitive information. Specifically, check and delete any query printing that might contain private data.

    :lua require("99").view_logs()
  8. Switch Models and Providers with fzf-lua

    master

    If you use fzf-lua instead of Telescope, use the following extensions to access the model and provider pickers.

    -- Switch models
    vim.keymap.set("n", "<leader>9m", function()
      require("99.extensions.fzf_lua").select_model()
    end)
    
    -- Switch providers
    vim.keymap.set("n", "<leader>9p", function()
      require("99.extensions.fzf_lua").select_provider()
    end)
  9. Switch Models and Providers with Telescope

    master

    If you have telescope.nvim installed, you can use the following functions to switch models or providers on the fly. Switching a provider will reset the model to that provider's default.

    -- Switch models
    vim.keymap.set("n", "<leader>9m", function()
      require("99.extensions.telescope").select_model()
    end)
    
    -- Switch providers
    vim.keymap.set("n", "<leader>9p", function()
      require("99.extensions.telescope").select_provider()
    end)
  10. Manage persistent work with _99.Extensions.Worker

    master

    The Worker extension provides a way to track ongoing tasks.

    1. Use set_work(opts) to define the work for the project. If opts.description is provided, no manual input capture is required.
    2. Use search() within the Worker context to find what remains to be done to complete the defined work item.