Patterns

Organize Context Spaces, sources, and skills in a .NET application.

Keep Context Spaces close to the domain they describe.

For a real application, create a folder that defines the Context Space and contains local source material if you use file-system sources.

Text
MyApp/
  Program.cs
  Agents/
    SupportAgent.cs
    PolicyReviewAgent.cs
  Context/
    ProductSupportContext.cs
    Docs/
      refund-policy.md
      troubleshooting.md
      escalation-rules.md
  Skills/
    support/
      SKILL.md
    policy-review/
      SKILL.md
  Tools/
    CreateSupportTicketTool.cs
    CustomerSubscriptionTool.cs

For the travel sample:

Text
Runiq.ContextTravelGuide/
  Context/
    TravelGuideContext.cs
    istanbul-guide.md
    bursa-guide.md
    ankara-guide.md
  Skills/
    trip-planning/
      SKILL.md
  Agents/
    TravelGuideAgent.cs
    PlainAgent.cs

Travel is only the sample domain. The pattern is the important part.

Keep Program.cs small

C#
builder.Services.AddRuniqServer(options =>
{
    options.AddContextSpace(ProductSupportContext.Create());

    options.AddAgent(SupportAgent.Create(openAiApiKey));
    options.AddAgent(PolicyReviewAgent.Create(openAiApiKey));
});

The Context Space definition owns the source and skill wiring. Program.cs only registers it.

Split knowledge and behavior

Put this in sourcesPut this in skills
Product docsHow to answer product support questions.
PoliciesHow to compare a request against policy.
City guidesHow to structure a practical itinerary.
RunbooksHow to summarize incident response steps.
Release notesHow to explain changes to different audiences.

Sources are content. Skills are instructions.

Attach narrowly

Not every agent needs every Context Space.

AgentAttach
Support Agentproduct-support
Billing Agentbilling-policy
Travel Agenttravel-planning
Plain AgentNo Context Space

This makes dashboard behavior easier to reason about. If an agent should not use a knowledge boundary, do not attach it.

Common mistakes

MistakeBetter approach
Treating Context Spaces as only file storage.Treat them as runtime context boundaries with sources, skills, metadata, and dashboard visibility.
Putting all knowledge into agent instructions.Put content in sources and behavior in skills.
Using skills as document dumps.Keep skills as reusable operational guidance.
Attaching every Context Space to every agent.Attach only the context each agent should use.
Assuming source names mean content was read.The agent should only claim source content when relevant excerpts are retrieved.

Good fits beyond travel

DomainContext Space examples
Customer supportHelp articles, refund policy, escalation skill.
Developer toolsAPI docs, migration guides, code review skill.
Finance operationsExpense policy, approval rules, audit response skill.
Healthcare adminProcedure docs, intake rules, compliance response skill.
Internal ITRunbooks, outage history, incident summary skill.
Sales engineeringProduct docs, objection handling skill, pricing notes.

Context Spaces are a framework feature for grounded agent behavior, not a travel-planning feature.

On this page