Key facts
| Retrieval | POST /v1/embeddings with plugsky-embed over code, docs and interface definitions |
| Generation | POST /v1/chat/completions with retrieved snippets and exact interface signatures |
| Coding models | plugsky-coder and plugsky-coder-fast suit generation; the catalogue holds 30+ models |
| Index unit | Chunk by function, class or module, keeping signatures and docstrings together |
| Pricing model | Flat monthly self-serve plans with unlimited fair-use usage |
| RAG status | RAG is live; embeddings plus chat completions are the building blocks |
| Freshness | Re-index changed files on merge so retrieval never cites removed APIs |
| Roadmap | Batch ingestion is coming soon; schedule incremental re-indexing yourself |
TL;DR
- Index symbols, not files: one chunk per function or class with its signature.
- Retrieve exact interfaces and pass them verbatim into the prompt.
- Exclude generated files, vendored code and anything containing secrets.
- Re-index on merge; stale interfaces produce confident wrong calls.
- Score retrieval recall separately from compile and test success.
How it works, step by step
- Decide the index scope: private libraries, service contracts, conventions and representative implementations.
- Parse symbols and chunk by function, class or module, keeping signatures and docstrings attached.
- Embed chunks with plugsky-embed and store metadata: repo, path, symbol, version and last commit.
- At generation time, retrieve interfaces and similar implementations under a context budget.
- Generate against the retrieved signatures, then compile and test in your pipeline.
- Measure retrieval recall and compile rate, and re-index changed paths on every merge.
Original data
Try it yourself
Open the vector database comparison →
Why code generation needs retrieval
Public code is in the model's training data; your code is not. Three gaps follow:
- Private APIs: internal libraries, service clients and platform helpers are invisible to the model, so it invents plausible alternatives.
- Version drift: a function name or parameter that existed last year may be gone; memories go stale faster than indexes.
- Conventions: error handling, logging and test structure are house style, and only your repository knows them.
Retrieval closes all three by putting the real signatures and examples in front of the model at generation time, and by making updates an indexing concern rather than a prompt rewrite.
Indexing a codebase
Code has structure; the index should preserve it:
- Chunk by symbol — function, class, module header — with the signature, docstring and a short usage example in the same chunk.
- Store canonical metadata: repository, path, symbol name, language, package version and commit hash.
- Skip generated code, vendored dependencies, test fixtures and minified assets; they crowd retrieval without helping.
- Never index secrets, environment files or credential material. Scan before embedding.
- Use incremental indexing keyed by file hash so merges update only what changed.
- Keep a small set of gold queries and expected symbols to detect index regressions.
Implementation and evaluation
At generation time, retrieval feeds a strict prompt:
- Extract symbols and intent from the task to build a precise retrieval query.
- Retrieve interfaces first, then similar implementations, under a fixed context budget.
- Pass signatures verbatim and instruct the model to call only retrieved symbols.
- Compile and test the result; if it calls an unretrieved API, treat that as a retrieval failure, not just a model failure.
Evaluate retrieval recall on a symbol-level gold set, then compile rate and test pass rate on generated code. Attribution matters: if recall is low, a stronger generation model will not fix the problem.
Limitations
Code RAG helps most where interfaces are stable and well-named, and least where logic is the hard part:
- Retrieval supplies contracts, not comprehension; complex algorithms and cross-module behavior still need human reasoning.
- Monorepos can exceed practical index sizes, so scope the index per package or team if latency matters.
- Licensing and provenance rules still apply to any code you index, especially code copied from elsewhere.
- A stale index produces confidently wrong calls, so treat re-indexing as part of the merge pipeline.
- Batch ingestion is coming soon, so large initial indexes should be built with your own rate-limited jobs.
Honest comparison
| Capability | Code RAG on Plugsky | Prompt with a few open files | Fine-tuned code model |
|---|---|---|---|
| Private APIs | Retrieved signatures at generation time | Only files manually pasted | In weights after training |
| Freshness | Re-index on merge | Whatever the developer selected | Retraining cadence |
| Conventions | Indexed standards and examples | Partial | Captured if training data includes them |
| Model choice | Coding models among 30+ aliases | One model | One tuned model |
| Evaluation | Recall plus compile and test rates | Ad hoc | Held-out benchmarks |
Frequently asked questions
What should I index for code generation?
Function and class definitions with signatures and docstrings, service contracts, coding standards and a selection of exemplar implementations. Skip generated and vendored code.
How do I chunk source code?
By symbol, not by line count. A function or class with its signature and docstring is a natural retrieval unit and produces cleaner prompts.
Will retrieval stop hallucinated APIs?
It greatly reduces them when the correct interface is retrieved. Instruct the model to use only retrieved symbols, and treat unretrieved calls as retrieval failures to fix.
Which embedding model should I use?
plugsky-embed for English-dominant codebases with English documentation; plugsky-embed-multilingual when comments, docs or identifiers mix languages including Arabic.
How do I keep the index fresh?
Index incrementally on merge using file hashes, and re-embed only changed symbols. Schedule a periodic full reconciliation to catch drift.
Can I use this with plugsky-coder models?
Yes. plugsky-coder and plugsky-coder-fast are the natural generation models, with retrieval supplying the interfaces they should call.
Can I prototype for free?
Yes. Embeddings and chat completions are live, the free plan includes two free models with no card, and the 14-day full-access trial opens the paid catalogue.