### Framework Layering Example Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-framework-selection/README.md An example of how to combine multiple frameworks across different architectural layers in a single project. ```text DSPy (compile L1) + LlamaIndex (retrieve L2) + LangGraph (orchestrate L3) + vLLM (serve L6) + optionally Dify (app platform L7) ``` -------------------------------- ### Chroma Setup Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-multi-tenant-rag/references/R1-vendor-filter-cheatsheet.md Initializes a persistent Chroma client and retrieves or creates a collection. ```python import chromadb client = chromadb.PersistentClient(path="./store") coll = client.get_or_create_collection("docs") ``` -------------------------------- ### Pinecone Setup with Namespace Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-multi-tenant-rag/references/R1-vendor-filter-cheatsheet.md Initializes the Pinecone client and demonstrates upserting vectors into a tenant-specific namespace. ```python from pinecone import Pinecone, ServerlessSpec pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"]) index = pc.Index("rag") # Upsert under tenant namespace index.upsert( namespace=tenant_id, vectors=[{ "id": chunk_id, "values": emb, "metadata": {"tenant_id": tenant_id, "doc_id": doc_id, "doc_type": doc_type}, }], ) ``` -------------------------------- ### Install Missing Dependencies Source: https://github.com/agentsope/skillalchemy/blob/master/SKILL.md Use these commands to install the necessary Lens and LEAP dependencies if the prerequisite check fails. ```bash npx skills add agentsope/SkillAlchemy/skills/Lens npx skills add agentsope/SkillAlchemy/skills/LEAP ``` -------------------------------- ### Install SkillAlchemy via Claude Code or Codex Source: https://github.com/agentsope/skillalchemy/blob/master/README.md Use an AI assistant to install SkillAlchemy from its GitHub repository. ```text Install SkillAlchemy from https://github.com/agentsope/SkillAlchemy and show me how to use it. ``` -------------------------------- ### Install Individual Skills Source: https://github.com/agentsope/skillalchemy/blob/master/README.md Add specific bundled skills to your project using the npx command. ```bash # Core components npx skills add agentsope/SkillAlchemy/skills/Lens npx skills add agentsope/SkillAlchemy/skills/LEAP # Another bundled Skill npx skills add agentsope/SkillAlchemy/skills/ ``` -------------------------------- ### Install SkillAlchemy via CLI Source: https://github.com/agentsope/skillalchemy/blob/master/README.md Use the npx command to add the SkillAlchemy package to your project. ```bash npx skills add agentsope/SkillAlchemy ``` -------------------------------- ### Qdrant Multi-Tenancy Setup Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-multi-tenant-rag/references/R1-vendor-filter-cheatsheet.md Initializes a Qdrant collection and creates a payload index with is_tenant set to True for performance optimization. ```python from qdrant_client import QdrantClient, models client = QdrantClient(url=os.environ["QDRANT_URL"]) client.create_collection( collection_name="docs", vectors_config=models.VectorParams(size=1536, distance=models.Distance.COSINE), ) client.create_payload_index( collection_name="docs", field_name="tenant_id", field_schema=models.KeywordIndexParams(type="keyword", is_tenant=True), ) ``` -------------------------------- ### Install Bio-Fraud Forensics Skill Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-bio-fraud-forensics/README.md Command to install the skill into the local Claude configuration directory. ```bash cp -r agentsop-bio-fraud-forensics ~/.claude/skills/agentsop-bio-fraud-forensics/ ``` -------------------------------- ### Skill Retrieval Configuration Source: https://github.com/agentsope/skillalchemy/blob/master/skills/LEAP/SKILL.md Example configuration for defining primary and secondary skills for fusion. ```text primary: "Interview Techniques" ← workflow skeleton secondary: ["BeiDou Navigation"] ← style/persona source depth: "standard" ``` -------------------------------- ### BootstrapFinetune distillation configuration Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-cost-tiered-models/references/R1-source-evidence.md Example of using BootstrapFinetune to optimize a student model using a teacher model. ```python BootstrapFinetune(student=Llama-3.2-1B-Instruct, teacher=gpt-4o-mini) ``` -------------------------------- ### LlamaIndex IngestionPipeline Setup Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-idempotent-ingestion/references/R2-cross-framework.md Configuring the IngestionPipeline with a document store and strategy for upserts and deletions. ```python from llama_index.core.ingestion import IngestionPipeline, DocstoreStrategy from llama_index.core.storage.docstore import SimpleDocumentStore from llama_index.core.node_parser import SentenceSplitter from llama_index.embeddings.openai import OpenAIEmbedding docstore = SimpleDocumentStore() # prod: Redis/Mongo/Postgres pipeline = IngestionPipeline( transformations=[ SentenceSplitter(chunk_size=1024, chunk_overlap=20), OpenAIEmbedding(model="text-embedding-3-small"), ], docstore=docstore, vector_store=vector_store, docstore_strategy=DocstoreStrategy.UPSERTS_AND_DELETE, ) ``` -------------------------------- ### Weaviate Multi-Tenancy Collection Setup Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-multi-tenant-rag/references/R1-vendor-filter-cheatsheet.md Configures a Weaviate collection with multi-tenancy enabled and creates a specific tenant. ```python from weaviate.classes.config import Configure from weaviate.classes.tenants import Tenant client.collections.create( name="Docs", multi_tenancy_config=Configure.multi_tenancy( enabled=True, auto_tenant_activation=True), ) client.collections.get("Docs").tenants.create([Tenant(name=tenant_id)]) ``` -------------------------------- ### Switch to durable Postgres checkpointing Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-langgraph/SKILL.md Use AsyncPostgresSaver for production persistence. Run setup in a migration job rather than at application boot. ```python from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver pass to .compile(checkpointer=...) await saver.setup() ``` -------------------------------- ### Setup LangChain SQLRecordManager Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-idempotent-ingestion/references/R2-cross-framework.md Initializes a SQLRecordManager for tracking document ingestion state in a persistent PostgreSQL database. ```python from langchain.indexes import index, SQLRecordManager record_manager = SQLRecordManager( namespace="rag/my_corpus", db_url="postgresql+psycopg://user:pass@host/db", # durable; not in-memory ) record_manager.create_schema() ``` -------------------------------- ### Aider launch patterns Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-aider/references/R2-sop-workflow.md Common CLI commands for starting Aider sessions based on project scope and requirements. ```bash aider ``` ```bash aider src/auth.py tests/test_auth.py ``` ```bash aider --architect --model o1 --editor-model gpt-4o ``` ```bash aider --subtree-only ``` ```bash aider --read CONVENTIONS.md ``` ```bash aider --test-cmd "pytest" --auto-test ``` -------------------------------- ### quick — Style Injection Example Source: https://github.com/agentsope/skillalchemy/blob/master/skills/LEAP/SKILL.md Demonstrates the injection of a secondary skill's questioning style into a primary workflow step with minimal rewriting. ```text Interview Techniques Step 3 "Generate Core Questions" → Inject BeiDou Navigation's questioning style: begin with a specific experience, establish rapport, and then probe further ``` -------------------------------- ### Deploy Dify via Docker Compose Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-dify/references/R2-sop-workflow.md Standard commands to clone the Dify repository, configure the environment, and start the services. ```bash git clone https://github.com/langgenius/dify cd dify/docker cp .env.example .env # edit .env: VECTOR_STORE, secrets, ... docker compose up -d ``` -------------------------------- ### Minimal DSPy End-to-End Workflow Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-dspy/SKILL.md A complete example demonstrating the definition of a signature, module, metric, compilation using MIPROv2, and saving the resulting program. ```python import dspy # 1. Signature class BasicQA(dspy.Signature): """Answer questions with short factoid answers.""" question: str = dspy.InputField() answer: str = dspy.OutputField(desc="often between 1 and 5 words") # 2. Module qa = dspy.ChainOfThought(BasicQA) # 3. Metric def metric(ex, pred, trace=None): return ex.answer.lower() in pred.answer.lower() # 4. Compile from dspy.teleprompt import MIPROv2 optimizer = MIPROv2(metric=metric, auto="light") compiled = optimizer.compile(qa, trainset=trainset) # 5. Save / load compiled.save("v1.json") ``` -------------------------------- ### Log repository state configuration Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-repo-state-gating/references/R2-gate-questions.md Example of the summary line to record in chat or notes to avoid re-gating in future sessions. ```text [repo-state: brownfield-large @ 2026-05-19] tool=Aider, primitive=repo-map, autonomy=approve, budget=5 files/<25k tok ``` -------------------------------- ### Refactor to StateGraph Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-langgraph/references/R2-sop-workflow.md Example of defining a custom state schema and building a StateGraph when prebuilt agents are no longer sufficient. ```python class S(TypedDict): messages: Annotated[list[AnyMessage], add_messages] retries: Annotated[int, operator.add] # …other typed fields g = StateGraph(S) g.add_node("llm", call_llm); g.add_node("tools", ToolNode(tools)) g.add_conditional_edges("llm", route) # END or "tools" g.add_edge("tools", "llm") g.set_entry_point("llm") graph = g.compile(checkpointer=postgres_saver) ``` -------------------------------- ### Check SkillAlchemy Dependencies Source: https://github.com/agentsope/skillalchemy/blob/master/SKILL.md Verify that the required Lens and LEAP skills are installed in the local environment. ```bash ls ~/.claude/skills/Lens/SKILL.md ls ~/.claude/skills/LEAP/SKILL.md ``` -------------------------------- ### Falsifiable Decision Heuristics Source: https://github.com/agentsope/skillalchemy/blob/master/skills/LEAP/references/skill-grammar.md Examples comparing invalid non-falsifiable heuristics with valid, falsifiable ones. ```text ❌ Invalid: "Think long-term." → Not falsifiable; it applies to every situation. ✅ Valid: "If a problem cannot be figured out in three minutes, put it in the Too Hard pile and skip it." → Falsifiable. ``` -------------------------------- ### Assemble Crew Configuration Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-crewai/references/R2-sop-workflow.md Example of initializing a Crew object with agents, tasks, and operational parameters like memory, verbosity, and step callbacks. ```python crew = Crew( agents=[researcher, analyst, writer], tasks=[research_task, analyze_task, write_task], process=Process.sequential, # default; read DC-2 before changing memory=False, # default off; see DC-4 verbose=True, max_rpm=30, planning=False, # 0.80+ experimental, test before prod step_callback=my_observer, # log every step ) result = crew.kickoff(inputs={"topic": "agentic RAG"}) ``` -------------------------------- ### LangChain similarity_search with vendor-specific filters Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-multi-tenant-rag/references/R1-vendor-filter-cheatsheet.md Demonstrates how LangChain forwards filter dictionaries directly to the underlying vector store. The first example shows a simple tenant filter, while the second shows a complex Chroma-specific operator filter. ```python docs = vectorstore.similarity_search( query, k=8, filter={"tenant_id": ctx.tenant_id}, ) # Chroma operators pass through: docs = vectorstore.similarity_search( query, k=8, filter={"$and": [ {"tenant_id": {"$eq": ctx.tenant_id}}, {"deleted": {"$eq": False}}, ]}, ) ``` -------------------------------- ### Cursor .mdc rule configuration Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-conventions-pinning/references/R2-tool-equivalents.md Example of YAML frontmatter in a .mdc file used to define rule scope and activation criteria. ```yaml --- description: Python style rules for our backend alwaysApply: false # only attach when glob matches globs: - "**/*.py" - "src/**/*.py" --- # Python style - 4-space indent - Type hints everywhere; ruff enforces ANN* ``` -------------------------------- ### MSC-02 SentenceWindowNodeParser Setup Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-multiscale-chunking/SKILL.md Configures a sentence window parser to embed sentences with surrounding context windows for improved synthesis. ```python SentenceWindowNodeParser(window_size=3) MetadataReplacementPostProcessor(target_metadata_key="window") ``` -------------------------------- ### MSC-03 HierarchicalNodeParser Setup Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-multiscale-chunking/SKILL.md Builds a hierarchical tree structure of nodes and configures an auto-merging retriever for vertical expansion. ```python HierarchicalNodeParser.from_defaults(chunk_sizes=[2048,512,128]) VectorStoreIndex AutoMergingRetriever ``` -------------------------------- ### Statistical Consistency Screening Example Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-bio-fraud-forensics/USAGE.md Shows how to check if reported statistical values are mathematically possible using the tool's GRIM analysis. ```text 你:Table 2 报 mean=5.27, N=43(整数量表),可能吗? 它:bottom line —— 这个均值对 43 个整数在数学上不可达(GRIM 不通过,硬旗)。 226/43=5.26、227/43=5.28,没有整数和能除出 5.27。 不能证明:不可能 ≠ 造假;打字错、N 记错、SEM/SD 混淆都会这样。值得发勘误澄清; 只有同一团队多处出现这种不可能时才有分量。 ``` -------------------------------- ### Hierarchical Routing Reality Check Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-agent-topology-selection/SKILL.md An example illustrating the discrepancy between expected routing behavior and the actual execution flow in a hierarchical agent structure. ```text Query: "Why is my laptop overheating?" (pure technical) Expected: triage → technical_agent → done Hierarchical reality: triage → technical → billing → … → last output wins ``` -------------------------------- ### Loop Body and Continuation Logic Pseudocode Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-bounded-loop/SKILL.md A framework-agnostic example showing how to increment a retry counter and determine whether to continue or terminate based on success predicates and budget limits. ```python def loop_body(state): new_state = do_one_iteration(state) new_state["retries"] = state.get("retries", 0) + 1 return new_state def should_continue(state) -> Literal["continue", "give_up"]: if state["retries"] >= MAX_RETRIES: return "give_up" if success_predicate(state): return "end" return "continue" ``` -------------------------------- ### Distillation Completion Report Source: https://github.com/agentsope/skillalchemy/blob/master/SKILL.md The final report generated upon completion, including installation instructions and usage examples. ```text ◆ Distillation Complete skill [Display name] · [name] type persona / tool · N lines research N agents · N+ Dilemma Cases output output/-skill/ install cp -r output/-skill \ ~/.claude/skills// try /[name] [suggested prompt] ``` -------------------------------- ### Search direction examples Source: https://github.com/agentsope/skillalchemy/blob/master/skills/LEAP/SKILL.md Examples of effective versus ineffective search directions for research agents. ```text Good: "What was the hardest decision at [event]? What options did they have?" Bad: "What is their leadership style?" ``` -------------------------------- ### Skill Package Directory Structure Source: https://github.com/agentsope/skillalchemy/blob/master/skills/LEAP/SKILL.md The standard file layout for a skill package. The runtime loads SKILL.md, while other directories like scripts, assets, and examples are included only as required by the skill's constraints. ```text / ├── SKILL.md # lean entry point — runtime loaded ├── skill.json # metadata (name, version, skill_mode, domain) ├── README.md # storefront (see template in shared layer) ├── references/ │ ├── sop_models.md # full operation model cards (runtime on-demand) │ └── research_notes.md # human-readable evidence summary ├── scripts/ # optional executable routines used by the skill ├── assets/ # optional templates or static resources ├── examples/ │ └── demo_conversation.md # persona: 3-4 scenarios (required) └── intermediate/ # pipeline audit trail ``` -------------------------------- ### MLflow Model Registry integration Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-per-model-artifacts/references/R2-versioning-recipes.md Example of logging model artifacts and promoting versions to production using MLflow. This approach is recommended for organizations managing more than 50 artifacts or 5 teams. ```python import mlflow, mlflow.dspy mlflow.set_tracking_uri("http://mlflow.internal:5000") mlflow.set_experiment("rag_synth") with mlflow.start_run(run_name=f"compile-{MODEL}-{DATASET_TAG}"): mlflow.log_params({"model": MODEL, "dataset": DATASET_TAG, "optimizer": "MIPROv2", "auto": "light"}) mlflow.log_metrics({"dev_score": dev_score, "test_score": test_score, "cost_usd": cost}) mlflow.dspy.log_model(compiled, artifact_path="program", registered_model_name=f"rag_synth-{MODEL}") # Promote to Production once swap_test + regression_gate pass client = mlflow.MlflowClient() client.transition_model_version_stage( name=f"rag_synth-{MODEL}", version=3, stage="Production", archive_existing_versions=True) ``` -------------------------------- ### Bootstrap Phase Configuration Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-repo-map/SKILL.md Steps to initialize the repository map, including ignore lists, language selection, and token budget allocation. ```text 1. 确认仓库类型:源码 + git 历史。否则不要用 repo-map(见 §6)。 2. 应用 ignore 列表: - .gitignore(必) - 自定义 ignore(如 Aider 的 .aiderignore;自建 agent 可直接复用) - 默认排除:vendor/, node_modules/, dist/, build/, *.min.js, generated/ 3. 选定 tree-sitter 语言集: - 主流(Python/JS/TS/Go/Rust/Java/C/C++/Ruby/PHP/...) 默认开 - 小众语言:要么接 grammars,要么留作 fallback(只列文件路径) 4. 设定 token 预算: - 小仓库(<200 文件): 1k–2k - 中等(200–2000 文件): 2k–4k - Monorepo(>2000 文件): 4k–8k + 限定子目录 5. 首次运行:构建符号表 + 引用图 + PageRank。后续增量更新。 ``` -------------------------------- ### Signature Phrase Examples Source: https://github.com/agentsope/skillalchemy/blob/master/skills/LEAP/references/skill-grammar.md Examples of signature expressions to be placed at the end of the 'How I Speak' section. ```text Feynman: "If you cannot explain it clearly to a first-year student, you do not really understand it." Jobs: "Stop. The question itself is wrong." ``` -------------------------------- ### vLLM SOP Workflow Steps Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-vllm/SKILL.md A step-by-step decision tree for configuring and optimizing vLLM deployments. ```text [Step 0] Confirm vLLM is the right tool ├─ Production, GPU-backed, concurrent users? → continue └─ Else → see §7 (ecosystem) and stop [Step 1] Pick the model + precision ├─ Model fits in single-GPU VRAM at BF16? → keep BF16, TP=1 ├─ Need 50% VRAM cut, ~zero quality loss? → FP8 (Hopper/Ada+) [arxiv 2411.02355] ├─ Need 4× VRAM cut, tolerate ~1.6pt avg drop? → AWQ-4 or GPTQ-4 └─ Reasoning-heavy / coding workload? → favor FP8 > AWQ; verify on eval set [Step 2] Choose parallelism ├─ Fits 1 GPU → TP=1, PP=1 ├─ Fits 1 node, NVLink present → TP=#GPUs/node ├─ Fits 1 node, only PCIe (e.g. L40S) → PP within node (TP-only over PCIe collapses) ├─ Multi-node → TP=GPUs/node, PP=#nodes └─ MoE model (Mixtral, DSv3) → DP attention + EP/TP for MoE layers [Step 3] Set memory/batch envelope ├─ --gpu-memory-utilization 0.90 (default; 0.85 if sharing GPU) ├─ --max-model-len = (longest realistic prompt + output) — NOT model max! ├─ --max-num-seqs (start 256; lower if preemption logs appear) └─ --max-num-batched-tokens (raise for TTFT; lower for ITL) [Step 4] Turn on the free wins ├─ enable_prefix_caching=True → if any system-prompt/few-shot reuse ├─ enable_chunked_prefill=True (V1: default on) → tame long-prompt HoL blocking └─ kv_cache_dtype="fp8" → +KV headroom, Ampere+ only [Step 5] Optional: speculative decoding ├─ Low QPS, latency-bound, have draft/EAGLE weights? → EAGLE-3 or MTP (high gain) ├─ No draft model, zero setup cost? → n-gram (modest gain, ~1.17×) └─ High QPS / large batch? → skip; gains shrink, complexity rises [Step 6] Benchmark on YOUR workload ├─ Replay representative ISL/OSL distribution ├─ Watch Prometheus: num_requests_waiting, KV cache occupancy, preemption count └─ Tune in this order: §3 Step 3 → Step 4 → Step 5 → reconsider Step 2 [Step 7] Scale out ├─ Latency SLA violated under load? → add a replica (data parallelism across pods) ├─ Tail TTFT high? → prefix-aware routing; pin prefix to replica └─ Cost too high? → revisit quantization, smaller model, draft model ``` -------------------------------- ### Pre-gate repository analysis commands Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-repo-state-gating/references/R2-gate-questions.md Run these three commands to gather metrics for Q1, taking approximately 15 seconds. ```bash git log --oneline | wc -l # N_commits git ls-files | wc -l # N_tracked ls -la # top-level shape ``` -------------------------------- ### Over-coding anti-pattern example Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-code-execution-decision/SKILL.md Example of a brittle heuristic that incorrectly attempts to force a subjective judgment into a programmatic rule. ```python if "!!!" in msg: tone = "hostile" ``` -------------------------------- ### Readiness Checklist for Prompt Compilation Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-prompt-compilation/SKILL.md A copy-paste checklist to verify that metrics are defined, data requirements are met, and budget constraints are established before running an optimizer. ```text GATE 1 — MEASURE [ ] metric(example, pred, trace=None) -> bool|float exists [ ] validated vs human: >=20 spot-checks (>=30 open-ended), >=80% agreement [ ] receipt saved {n_spot_checks, agreement, judge_model, task_model, date} [ ] NOT a lone holistic LLM-judge (else decompose via [[agentsop-metric-design]] first) GATE 2 — DATA [ ] labeled examples counted: N = ____ [ ] N clears the floor of the optimizer chosen below [ ] (prompt-based optimizers) 20/80 train/val split planned; GEPA uses standard split PICK + BUDGET [ ] optimizer chosen by §4.2 (GEPA if textual feedback) [ ] cost ceiling set; cheap optimizer LM chosen; track_usage=True [ ] plan: probe auto="light" first, escalate only on >=2% lift, confirm on held-out test ``` -------------------------------- ### Persona Distinctiveness Examples Source: https://github.com/agentsope/skillalchemy/blob/master/skills/LEAP/references/skill-grammar.md Examples of good and bad 'Things I Would Never Say' to establish persona distinctiveness. ```text ✅ Good: Munger would never say, "In my experience." He would say, "I have seen too many people fail at this." Jobs would never say, "That direction also has merit." He would say, "This is shit," or, "This is amazing." ❌ Bad: "I would not say anything unprofessional." This is too generic to be distinctive. ``` -------------------------------- ### Raw pytest output example Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-test-fix-loop/references/R2-feedback-formatting-recipes.md An example of verbose, high-token pytest output containing session info, test results, and failure details. ```text ============================= test session starts ============================== platform darwin -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0 rootdir: /Users/dev/project configfile: pyproject.toml plugins: cov-5.0.0, anyio-4.4.0, asyncio-0.23.8 collected 47 items tests/test_auth.py ..F.... [ 15%] tests/test_billing.py ............ [ 40%] tests/test_routes.py .............. [ 70%] tests/test_models.py .............. [100%] =================================== FAILURES =================================== __________________________ test_jwt_expiry_handling ____________________________ def test_jwt_expiry_handling(): token = make_token(exp=None) > assert verify_token(token) is None E TypeError: '<' not supported between instances of 'NoneType' and 'datetime.datetime' tests/test_auth.py:42: TypeError [lots more boilerplate, coverage report, warnings...] =========================== short test summary info ============================ FAILED tests/test_auth.py::test_jwt_expiry_handling - TypeError: '<' not... =================== 1 failed, 46 passed in 3.21s =========================== ``` -------------------------------- ### Hierarchical Task Execution Example Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-crewai/SKILL.md An example demonstrating the limitation of hierarchical task execution where the manager may execute all tasks instead of routing based on triage. ```text Query: "Why is my laptop overheating?" (纯技术问题) 期望: triage → technical_agent → done 实际 hierarchical: triage → technical → billing → ... → 最后一个 task 的输出覆盖前面 ``` -------------------------------- ### Weaviate Write and Read Operations Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-multi-tenant-rag/references/R1-vendor-filter-cheatsheet.md Demonstrates inserting data and querying a multi-tenant collection using the mandatory .with_tenant() method. ```python coll = client.collections.get("Docs").with_tenant(ctx.tenant_id) # Insert coll.data.insert(properties={"text": chunk, "doc_type": "policy"}, vector=emb) # Query res = coll.query.near_vector(near_vector=emb, limit=8) ``` -------------------------------- ### SOP Workflow Steps Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-metric-design/SKILL.md The sequential checklist for designing and implementing an agent metric. ```text 0. Confirm activation criteria (§1) 1. DECOMPOSE: list orthogonal criteria 2. CHOICE: bool vs float per criterion 3. WRITE: implement sub-judges + aggregator 4. BIAS-TEST: probe for length, position, self-preference 5. CALIBRATE: ≥20 human spot-checks; agreement ≥80% 6. SHIP: hand metric to optimizer / eval loop ``` -------------------------------- ### Production-ish vLLM serve command for Llama-3.1-70B Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-vllm/references/R2-sop-workflow.md A production-ready command to serve the Llama-3.1-70B-Instruct model with optimizations like FP8 quantization, prefix caching, and chunked prefill enabled. ```bash vllm serve meta-llama/Llama-3.1-70B-Instruct \ --quantization fp8 \ --tensor-parallel-size 2 \ --max-model-len 8192 \ --max-num-seqs 256 \ --max-num-batched-tokens 8192 \ --gpu-memory-utilization 0.90 \ --enable-prefix-caching \ --enable-chunked-prefill \ --kv-cache-dtype fp8 ``` -------------------------------- ### Define a metric function Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-dspy/references/R2-sop-workflow.md A basic metric function comparing the lowercase answer of an example with the predicted answer. ```python def metric(example, pred, trace=None): return example.answer.lower() == pred.answer.lower() ``` -------------------------------- ### Web Interface Pre-clear Ritual Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-session-state-hygiene/references/R2-tool-commands.md A manual workflow to preserve context before starting a new chat session. ```text You: summarize what we decided and the current state in one paragraph [copy] [ click New chat ] You: [paste paragraph]; continue from here. ``` -------------------------------- ### Import Langfuse SDK Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-observability-setup/SKILL.md Initialize the Langfuse client for framework integration. ```python from langfuse import Langfuse ``` -------------------------------- ### Enable SDK logging Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-prompt-history-inspect/SKILL.md Set environment variables to log full HTTP requests and responses for OpenAI or Anthropic SDKs. ```bash export OPENAI_LOG=debug ``` ```bash export ANTHROPIC_LOG=debug ``` -------------------------------- ### Inspect DSPy history Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-dspy/SKILL.md Use this command to review the outputs of your zero-shot program on hand-picked examples during the programming stage. ```python dspy.inspect_history(n=3) ``` -------------------------------- ### Claude Code path-scoped rule example Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-conventions-pinning/references/R2-tool-equivalents.md Rules can be scoped to specific file paths using YAML frontmatter. ```markdown --- paths: - "src/api/**/*.ts" - "src/api/**/*.tsx" --- # API rules - All endpoints validate input with zod - Return errors via the standard error envelope ``` -------------------------------- ### Initialize LlamaIndex Baseline Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-llamaindex/SKILL.md Sets up the global Settings and creates a basic VectorStoreIndex. Pin Settings at application boot to avoid embedding-mismatch failures. ```python from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings from llama_index.core.node_parser import SentenceSplitter Settings.llm = OpenAI(model="gpt-4o-mini") Settings.embed_model = OpenAIEmbedding(model="text-embedding-3-small") Settings.node_parser = SentenceSplitter(chunk_size=1024, chunk_overlap=20) docs = SimpleDirectoryReader("./data").load_data() index = VectorStoreIndex.from_documents(docs) qe = index.as_query_engine(similarity_top_k=4) ``` -------------------------------- ### Common production pattern workflow Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-vllm/references/R5-ecosystem-context.md A visual representation of the recommended deployment strategy for LLM inference in 2026, moving from local development to production benchmarking and specialized engine selection. ```text Local development → Ollama (model switching, prototyping) ↓ Production benchmarking → vLLM (default) ↓ If prefix-heavy workload → A/B with SGLang ↓ If NVIDIA-locked + 1–2wk → A/B with TensorRT-LLM ↓ If CPU/edge segment → llama.cpp/GGUF for that segment ``` -------------------------------- ### SOP Workflow Steps Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-prompt-compilation/SKILL.md The sequential checklist for the prompt compilation process, from activation confirmation to final decision-making. ```text 0. Confirm activation (§1): plateaued hand-tuning + metric + examples. 1. GATE 1 — metric exists AND validated ≥20 human spot-checks? [hard] 2. GATE 2 — example count ≥ floor for the chosen optimizer? [hard] 3. PICK — choose optimizer by data scale + feedback signal. (§4.2) 4. BUDGET — estimate cost; cap it; choose a cheap optimizer LM. 5. PROBE — run auto="light" (or smallest config) as a signal. 6. DECIDE — gain ≥ threshold → escalate; else go back, don't escalate. ``` -------------------------------- ### Prompt inspection decision tree Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-prompt-history-inspect/SKILL.md A visual guide for identifying the correct inspection method based on the framework used. ```text LM call surprised you? │ Yes ──► STOP. Do not edit the prompt. Do not retry. Do not swap models. │ ▼ What framework? DSPy → dspy.inspect_history(n=1) LangChain → set_debug(True) LangGraph → graph.get_state_history(config) CrewAI → step_callback + verbose=True Aider → /diff AND aider --verbose Raw OpenAI/Anth → OPENAI_LOG=debug / ANTHROPIC_LOG=debug Clean dump → httpx event hook (OP-7) Production bug → LangSmith / LangFuse / Phoenix trace │ ▼ Diff dump against expectation. Identify layer (1/2/3 — §3 Step 3). │ ▼ Fix at correct layer. Re-dump. Confirm prompt now matches. │ ▼ NOW check if the bug is fixed. If not, repeat from inspect. ``` -------------------------------- ### tsc Raw Output Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-test-fix-loop/references/R2-feedback-formatting-recipes.md Example of raw TypeScript compiler output showing specific error codes and code snippets. ```text src/auth.ts:47:13 - error TS2367: This comparison appears to be unintentional because the types 'Date | undefined' and 'Date' have no overlap. 47 if (exp < now) { ~~~ src/billing/charge.ts:103:11 - error TS2532: Object is possibly 'undefined'. 103 return user.id; ~~~~~~~ Found 2 errors in 2 files. ``` -------------------------------- ### Initialize LlamaIndex evaluation components Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-llamaindex/references/R2-sop-workflow.md Sets up a dataset generator and retriever evaluator to track retrieval performance metrics. ```python from llama_index.core.evaluation import ( DatasetGenerator, FaithfulnessEvaluator, RelevancyEvaluator, RetrieverEvaluator, ) qa = DatasetGenerator.from_documents(docs).generate_dataset_from_nodes(num=50) ret_eval = RetrieverEvaluator.from_metric_names(["mrr","hit_rate"], retriever=index.as_retriever()) ``` -------------------------------- ### ESLint Raw Output Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-test-fix-loop/references/R2-feedback-formatting-recipes.md Example of raw ESLint output containing absolute file paths and multiple linting issues. ```text /Users/dev/project/src/auth.ts 12:1 error 'os' is defined but never used no-unused-vars 47:5 error Expected '===' and instead saw '==' eqeqeq 88:80 warning Line 88 exceeds the maximum line length of 80 max-len /Users/dev/project/src/billing.ts 103:5 error 'foo' is defined but never used no-unused-vars ✖ 4 problems (3 errors, 1 warning) 3 errors and 0 warnings potentially fixable with the `--fix` option. ``` -------------------------------- ### Program of Thought arithmetic implementation Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-code-execution-decision/SKILL.md Example of switching from prose to code execution for deterministic arithmetic tasks to ensure accuracy. ```python subtotal = sum([...]); tax = round(subtotal * 0.0825, 2); total = subtotal + tax ``` -------------------------------- ### Canonical Aider workflow loop Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-aider/references/R2-sop-workflow.md A visual representation of the standard Aider development cycle from initialization to testing. ```text git status clean? --> launch aider --> /ask plan --> /add files --> /code edit --> review diff --> auto-commit --> /test --> /undo or continue ^ | +---------------------- /clear when topic shifts ---------------------------------+ ``` -------------------------------- ### SOP Workflow Steps Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-cost-tiered-models/SKILL.md A structured 5-step process for analyzing, tiering, measuring, and tuning LLM workflows to balance quality and cost. ```text [Step 0] 列出工作流里所有 LM 调用 └─ 对每次调用记:它在"想"还是在"做"?预期调用频率? [Step 1] 给每次调用打认知负荷标签 ├─ 高推理(规划/路由/判断/提案/纠错) → 候选 Tier-S └─ 机械执行(改写/抽取/格式化/应用决定/草稿) → 候选 Tier-E 规则:把"需要全局判断 / 一旦错代价高 / 频率低"的归 Tier-S, 其余尽量下沉到 Tier-E。 [Step 2] 分配模型层 ├─ Tier-S → 你能负担的最强 reasoner(少量调用,单价高无所谓) ├─ Tier-E → 便宜/快模型(大量调用,单价主导总成本) └─ 给 Tier-E 选最适配它的输出格式(弱模型用 whole/简单 schema, 不要逼它产 token 高效但易错的 diff)。 [Step 3] 度量质量 delta(必须做,否则是赌博) ├─ baseline:全程强模型的质量分 + 成本 ├─ split:S+E 拆分后的质量分 + 成本 ├─ 看 (质量 delta, 成本 delta) 这一对,不要只看其一 └─ 在你自己的真实任务上量,不要信别人 benchmark 的绝对数 [Step 4] 装升级阀门 ├─ 定义"执行层失败"的可检测信号(格式不合法 / 测试不过 / │ schema 校验失败 / 自评分低) ├─ 失败 → 升级到 Tier-S 重试这一步(或换执行格式重试) └─ 记录升级率:若 >30%,说明这步本就属于 Tier-S,重新归类 [Step 5] 调拆分点(tune the split) ├─ 升级率高 / 质量掉太多 → 把更多步上移到 Tier-S ├─ 升级率近 0 / 质量持平 → 把更多步下沉到 Tier-E,再省一截 └─ 拆分点是个滑块,不是开关;按 Step 3 的数往返调 ``` -------------------------------- ### Generate LlamaIndex evaluation dataset Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-domain-eval-set/references/R1-source-evidence.md Use the DatasetGenerator to create a synthetic evaluation dataset from documents, with a default of 50 examples. ```python DatasetGenerator.from_documents(docs).generate_dataset_from_nodes(num=50) ``` -------------------------------- ### Optional pre-gate activity commands Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-repo-state-gating/references/R2-gate-questions.md Additional commands to measure recent activity and contributor count for Q1. ```bash git log --since='90 days ago' --oneline | wc -l git shortlog -sn | wc -l ``` -------------------------------- ### Constraint Primitives: dspy.Assert vs dspy.Suggest Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-dspy/SKILL.md Demonstrates the difference between hard assertions that halt execution and soft suggestions that trigger self-refinement via feedback. ```python # Hard: halts after max retries with dspy.AssertionError dspy.Assert(len(pred.answer) < 100, "Answer must be < 100 chars") # Soft: retries with feedback in prompt, logs failure, continues dspy.Suggest(is_valid_json(pred.output), "Output must be valid JSON") ``` -------------------------------- ### Insecure Post-Retrieval Filtering Pattern Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-multi-tenant-rag/SKILL.md An example of a security defect where tenant isolation is attempted after the data has already been retrieved from the vector store. ```python results = vs.query(...); results = [r for r in results if r.metadata["tenant"] == ctx.tenant] ``` -------------------------------- ### Initialize Phoenix Auto-Instrumentation Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-observability-setup/SKILL.md Launch the Phoenix application and register auto-instrumentation for OpenTelemetry-based tracing. ```python px.launch_app() register(auto_instrument=True) ``` -------------------------------- ### Cline conditional rule configuration Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-conventions-pinning/references/R2-tool-equivalents.md Example of using path-based frontmatter in a .clinerules file to apply specific rules to React components. ```markdown --- paths: - "src/**/*.tsx" - "components/**/*.tsx" --- # React component rules - Functional components only - Hooks at top of function body ``` -------------------------------- ### Create package workspace structure Source: https://github.com/agentsope/skillalchemy/blob/master/skills/LEAP/SKILL.md The directory structure required for a new skill workspace at output/-skill/. ```text output/-skill/ ├── README.md ├── SKILL.md.draft ├── references/ # agent reports + exemplars ├── intermediate/ # structured data └── examples/ # persona: required; tool: optional ``` -------------------------------- ### Deploy and track DSPy program usage Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-dspy/references/R2-sop-workflow.md Deployment options for lightweight or production environments and enabling usage tracking. ```python dspy.asyncify(program) dspy.configure(track_usage=True) program.get_lm_usage() ``` -------------------------------- ### Frontmatter configuration Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-test-fix-loop/README.md The metadata defining the skill name and version. ```yaml name: test-fix-loop version: 0.1.0 ``` -------------------------------- ### Standard Operating Procedure (SOP) Workflow Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-domain-eval-set/SKILL.md The sequential steps for establishing a domain evaluation set, from activation to domain-specific gating. ```text 0. Confirm activation (§1) — is the question "does this work on OUR data"? 1. COLLECT — sample real domain examples; stratify; pull edge cases (OP-DE01) 2. LABEL — gold answer / reference / pass-fail; 2 annotators on subset (OP-DE02) 3. HOLD OUT — split train/dev/test; SEAL the test split (OP-DE03) 4. SIZE — land at 50-200; per-segment counts (OP-DE04) 5. VERSION — hash + date + rubric; freeze as an artifact (OP-DE05) 6. LEAK-AUDIT — diff held-out vs demos / train / fine-tune data (OP-DE07) 7. PAIR — report alongside public bench; gate on the domain set (OP-DE08) (later) REFRESH on domain shift (OP-DE06) ``` -------------------------------- ### Enable autologging for LangSmith, Phoenix, and MLflow Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-observability-setup/SKILL.md Minimal configuration to enable tracing for the chosen backend. LangSmith uses environment variables, while Phoenix and MLflow require specific Python initialization calls. ```python # LangSmith — env vars only, no code change (auto-traces LangChain/LangGraph): # export LANGSMITH_TRACING=true # export LANGSMITH_API_KEY=... export LANGSMITH_PROJECT=my-app # (raw SDK / non-LangChain: wrap calls with langsmith.wrappers.wrap_openai or @traceable) # Phoenix — launch local app + auto-instrument: import phoenix as px; px.launch_app() from phoenix.otel import register register(auto_instrument=True) # picks up installed framework instrumentors # MLflow — one autolog call per framework: import mlflow mlflow.set_tracking_uri("http://localhost:5000") mlflow.dspy.autolog() # or mlflow.langchain / mlflow.openai / mlflow.crewai ``` -------------------------------- ### DSPy optimization decision tree Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-dspy/references/R2-sop-workflow.md A decision flow for troubleshooting program output, metric alignment, and selecting the correct optimizer based on example count. ```text [Stage 1] Plausible un-optimized output? No → fix signature / module / decomposition Yes ↓ [Stage 2] Metric agrees with human ≥ 80%? No → decompose metric, sub-judges, length penalty Yes ↓ Have ≥ 30 examples? No → collect more, or use LabeledFewShot as floor Yes ↓ [Stage 3] Pick optimizer (see R3 Case A): ≤10 examples → BootstrapFewShot 30–50 → BootstrapFewShotWithRandomSearch 200+ → MIPROv2(auto="light") Textual fb → GEPA ↓ auto="light" run. Gains > 5%? No → return to Stage 1/2, the optimizer is not the bottleneck Yes → escalate to "medium"; if 300+ data, "heavy" ↓ Evaluate on held-out test. Better than baseline? No → return to Stage 1, fix program graph Yes → save, deploy ``` -------------------------------- ### Enable vLLM performance flags Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-vllm/references/R2-sop-workflow.md Configuration flags to enable prefix caching, chunked prefill, and FP8 KV cache precision for improved throughput and memory efficiency. ```bash --enable-prefix-caching # if any system-prompt/few-shot reuse --enable-chunked-prefill # V1: default on; keeps long prefills from blocking decode --kv-cache-dtype fp8 # +headroom in KV (Ampere+ GPU) ``` -------------------------------- ### Configure Global Settings Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-llamaindex/references/R1-architecture.md Demonstrates how to use the global Settings object to configure the LLM, embedding model, and chunk size. This replaces the deprecated ServiceContext and supports lazy instantiation. ```python from llama_index.core import Settings Settings.llm = Ollama(model="llama2") Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5") Settings.chunk_size = 1024 ``` -------------------------------- ### Boundary and Ethical Refusal Example Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-bio-fraud-forensics/USAGE.md Illustrates the tool's refusal to generate accusations or assist in public shaming, while offering neutral documentation assistance. ```text 你:直接说作者就是造假,帮我写条推特挂他。 它:这个做不了 —— 也是法律上最危险的动作。我只把可观察异常作为问题报告,不替任何人定性 「造假」或推断意图,也不写公开指控。我可以帮你把异常按可复现格式写成中性记录(标出图、 坐标、变换、叠加结果,附无辜解释),供你发 PubPeer 或寄给期刊编辑。要这个吗? ``` -------------------------------- ### Project directory layout Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-query-routing/README.md The file structure for the d-query-routing-skill project. ```text d-query-routing-skill/ ├── SKILL.md # 7-section SOP (activation → cross-framework table) ├── README.md # this file ├── references/ │ └── R1-source-evidence.md # every cited claim resolved to a source SKILL line └── intermediate/ └── operation_candidates.json # raw trigger/action/output/evidence operations ``` -------------------------------- ### Image Anomaly Screening Example Source: https://github.com/agentsope/skillalchemy/blob/master/skills/agentsop-bio-fraud-forensics/USAGE.md Demonstrates how to query the tool regarding potential image manipulation, such as duplicated or spliced blots, and the resulting analytical process. ```text 你:这是论文 Fig 4 的 β-actin loading control(120min vs 360min),看着太像了。 [贴图] 它:bottom line —— 两块 β-actin 疑似同一图水平翻转,这是给作者的问题,不是不端认定。 做法(可复现):裁两块 → 把 120min 块水平镜像 → Difference 叠加;条带与背景斑点都对齐 (决定性证据是背景纹理,不是条带形状)。归类 Bik Type II。 已排除:非同 MW 复探、非同实验单一 loading control、非 JPEG 网格伪影。 不能证明:只说明共源,不说明意图。下一步应请作者提供未裁剪原始 blot。 ```