Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/codeblockz/langchain-community-plugin/new-raggit clone --depth 1 https://github.com/Codeblockz/langchain-community-pluginWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00021 | $0.03455 |
| Opus 5 | $0.00010 | $0.01728 |
| Sonnet 5 | $0.00004 | $0.00691 |
| Haiku 4.5 | $0.00002 | $0.00346 |
Grade A, and why
new-rag scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 602 lines — stays where its author put it; the contents beside it link to each section on GitHub.
New RAG Pipeline Command
Create a new RAG pipeline file with best practices baked in.
Workflow
-
Ask the user which vector store they want:
InMemory- Quick prototyping, no persistenceFAISS- Local, file-based persistenceChroma- Local with server optionpgvector- PostgreSQL-basedPinecone- Managed cloud service
-
Get filename from argument or ask user (default:
rag_pipeline.py) -
Generate the RAG file using the appropriate template below
-
Inform user about next steps (install dependencies, configure embeddings)
Templates
InMemory Template
"""
RAG Pipeline using InMemoryVectorStore
Install: pip install langchain langchain-openai
"""
from langchain_community.document_loaders import WebBaseLoader
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_core.vectorstores import InMemoryVectorStore
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_core.runnables import RunnablePassthrough
from langchain_openai import OpenAIEmbeddings, ChatOpenAI
# 1. Load documents
def load_documents(urls: list[str]):
"""Load documents from URLs."""
docs = []
for url in urls:
loader = WebBaseLoader(url)
docs.extend(loader.load())
return docs
# 2. Split into chunks
def split_documents(docs, chunk_size=1000, chunk_overlap=200):
"""Split documents into chunks for embedding."""
splitter = RecursiveCharacterTextSplitter(
chunk_size=chunk_size,
chunk_overlap=chunk_overlap,
add_start_index=True,
)
return splitter.split_documents(docs)
# 3. Create vector store
def create_vectorstore(chunks):
"""Create vector store from document chunks."""
embeddings = OpenAIEmbeddings()
vectorstore = InMemoryVectorStore.from_documents(chunks, embeddings)
return vectorstore
# 4. Build RAG chain
def build_rag_chain(vectorstore):
"""Build the RAG chain."""
retriever = vectorstore.as_retriever(search_kwargs={"k": 4})
prompt = ChatPromptTemplate.from_template("""
Answer the question based only on the following context.
If you cannot answer based on the context, say "I don't know."
Context:
{context}
Question: {question}
Answer:
""")
llm = ChatOpenAI(model="gpt-4o", temperature=0)
def format_docs(docs):
return "\n\n".join(doc.page_content for doc in docs)
chain = (
{"context": retriever | format_docs, "question": RunnablePassthrough()}
| prompt
| llm
| StrOutputParser()
)
return chain
def main():
# Example usage
urls = [
"https://example.com/page1",
"https://example.com/page2",
]
print("Loading documents...")
docs = load_documents(urls)
print(f"Loaded {len(docs)} documents")
print("Splitting documents...")
chunks = split_documents(docs)
print(f"Created {len(chunks)} chunks")
print("Creating vector store...")
vectorstore = create_vectorstore(chunks)
print("Building RAG chain...")
chain = build_rag_chain(vectorstore)
# Query
question = "What is this about?"
print(f"\nQuestion: {question}")
answer = chain.invoke(question)
print(f"Answer: {answer}")
if __name__ == "__main__":
main()
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 602 lines · 21 tokens per session scan A 31e5ad9cc074
new-rag is a command published in the GitHub repository Codeblockz/langchain-community-plugin (3 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 21 tokens to every session and 3,455 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
date
询问当天的日期,输出的格式为 yyyy-MM-dd 星期几.
add-eval
Create a new evaluator for assessing agent performance.
add-subgraph
Create a modular subgraph that can be composed into the main workflow.
human-in-the-loop
Add human approval or intervention points to your workflow.
run-evals
Execute the evaluation suite against the LangGraph agent.
add-node
Create a new node in the LangGraph workflow.