Skip to content

v3: Agent framework, Aspire integration, Telegram client#6

Merged
LeftTwixWand merged 264 commits into
masterfrom
v3
Mar 18, 2026
Merged

v3: Agent framework, Aspire integration, Telegram client#6
LeftTwixWand merged 264 commits into
masterfrom
v3

Conversation

@LeftTwixWand
Copy link
Copy Markdown
Contributor

Summary

Complete rewrite of the IAW multi-agent runtime — 250 commits, 430 files changed.

Core Agent Framework (v3)

  • Agent base class with partials: Core, Events, Lifecycle, State, Streams, Tools, Tracking, Observers
  • Durable state via Orleans Journaling (replaces classic [Persistent])
  • Communication: direct GetResponse(), typed P2P via IReceiver<T>, pub/sub via Orleans streams
  • Context enrichment: User, Project, Task, RAG, Memory providers injected before every LLM call
  • History management: auto-summarization at 40 messages, 3-tier chat reducer
  • OpenTelemetry: GenAI semantic conventions, activity source "IAW", token/duration metrics

Aspire Integration

  • Aspire.Hosting.IAW: AddIAW(), WithLLM<T>(), WithStorage(), WithVectorDb(), WithVoice2Text<T>()
  • Aspire.IAW.Client: AddIAW() for silos, AddIAWClient() for clients
  • AspireAgent: connects to running Aspire MCP server, gets live resource health/logs/traces

Telegram Client

  • Forum topic routing (Personal, IAW, Scheduled, Notifications)
  • Voice transcription via local Whisper
  • Photo/document upload to blob storage
  • Streaming responses with auto-splitting at 4096 chars
  • Scheduled job result delivery to correct topic
  • MarkdownV2 escaping with plaintext fallback

Code Orchestration

  • CodeOrchestrator generates standalone C# console apps that call agent interfaces
  • Auto-discovers all agents via InterfaceCatalog (no hardcoded agent lists)
  • Out-of-process execution with timeout and error capture

65+ Agent Implementations

  • Infrastructure: Shell, FileSystem, Build, Git, Aspire, Reviewer
  • LLM wrappers: Claude, GPT, Gemini, Grok, Ollama models
  • Memory: User, Project, Pattern, Episode, Code memory agents
  • Orchestration: CodeOrchestrator, Project, UserProfile, UISession

Test plan

  • dotnet build IAW.slnx passes
  • dotnet test test/Core.Tests — 297 passing (45 pre-existing FormTests failures)
  • Aspire dotnet run — all resources healthy
  • Telegram: send message in Personal topic, get streamed response
  • Telegram: schedule job, receive result in topic
  • IAW topic: "what's the system status?" → AspireAgent uses MCP tools

🤖 Generated with Claude Code

LeftTwixWand and others added 30 commits March 7, 2026 17:20
…tream publishing

Move PublishToStreamAsync and GetActiveSubscriptionsAsync into dedicated
partial. Add SubscribeToStreamConsumerInterfaces for automatic stream
subscription on activation based on IStreamConsumer<T> interfaces.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Marker interfaces extending IAgent for agents that want to advertise
event-driven or streaming capabilities via the type system.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… F-H)

- 5 sample agents: CodeReviewAgent, InfraMonitorAgent, CIPipelineAgent, PersonalAssistantAgent, KnowledgeBaseAgent
- AgentRegistryGrain with durable registration, query by kind/capabilities/publishes/subscribes
- AgentRegistrationStartupTask for auto-discovery of agent types
- 6 new registry tests (register/get, query by kind, get all, unregister, query by capability, query by publishes)
- All 74 tests pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ehavior tests

Introduces AgentTestV3<TAgent> in IAW.Testing package — a reusable test
base class for V3 agents with self-contained silo/client configurators.
CoreAgentV3Tests inherits all 20 tests in a single line. Total: 94 passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ture guards

Adds 50 new tests across 5 test files covering message type contracts,
EventTypeToStreamName mapping, FileTools/WorkspaceTools behavior, and
reflection-based architecture invariants for the V3 agent system.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add [GrainType("agent-registry")] to AgentRegistryGrain for stable grain type ID
- Change DurableChatHistoryProvider from public to internal (implementation detail)
- Add SSRF protection to WebTools: scheme validation, blocked hosts, DNS resolution checks
- Create docs/api-surface.md listing all 50+ public V3 types
- Create docs/serialization-contracts.md with full [Id(n)] audit
- Create docs/migration-v2-to-v3.md with V2-to-V3 method mapping
- Create docs/security.md with FileTools, ShellTools, WebTools, grain, and serialization audit

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update all existing pages and create new ones for the V3 agent architecture:
- Homepage, Getting Started, Architecture, Building Agents, Testing, API Reference
- New: Events & Streams, Message Types, Conversation, Tools, Tracking behaviors
- New: 5 use-case tutorials (code review, infra monitor, personal assistant, knowledge base, CI/CD)
- Remove old notifications.md (replaced by events-streams.md)
- Update VitePress sidebar with new sections

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ata, release checklist

- Update README.md with V3 Agent constructor, typed messages, stream composition
- Add .github/workflows/nuget.yml for tag-triggered NuGet publishing
- Add NuGet package metadata to Core.csproj (IAW.Core 3.0.0-preview.1)
- Create docs/release-checklist.md with pre/post release steps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… tests

- Renamed all Core.V3 namespaces to IAW.Core across source, test, and consumer files
- Moved V3 subdirectories (Communication, Messages, Registry, etc.) up to src/Core/
- Moved V3 root files (Agent.cs, IAgent.cs, etc.) up to src/Core/
- Removed src/Core/V3/ and test/Core.Tests/V3/ directories
- Renamed v3-history/v3-tracking memory keys to history/tracking
- Renamed test classes (AgentV3Tests -> AgentTests, TestAgentV3 -> TestAgent, etc.)
- Renamed AgentTestV3 to AgentTest in IAW.Testing
- Updated MemoryAttribute, TrackingOptions, IMonitorSourceProvider to IAW.Core namespace
- Fixed duplicate using directives in consumer projects
- Fixed V3Agent alias in DevUI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Task 7: Verified StateEntry(Key, Value) matches production StateDescriptor
- Task 8: Added public PublishAsync overload without CancellationToken
- Task 9: Added ValidatePathWithinWorkspace to Agent.State.cs
- Task 10: Added virtual HandleEvent method bridging to HandleEventAsync
- Task 11: Added SendMessage streaming method returning IAsyncEnumerable<AgentResponse>
- Task 12: Added IConversationalAgent and IStatefulAgent marker interfaces
- Task 13: Added DevVisibleAttribute
- Task 14: Updated AI, GitHub, Routing namespaces from Core.* to IAW.Core.*
- Task 15: Copied Orchestration support types (OrchestrationPlan, ScriptGenerator, ScriptExecutor)
- Task 16: Verified AgentResponse and AgentResponseKind already exist
- Task 17: Copied Communication message types (CodeChanged, TestResult, TaskAssigned, AgentProgressUpdate)
- Task 18: Copied WorkspaceFiles utility with namespace IAW.Core.Tools

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port all production agents from E:\IAW\src\Agents\Base\ to V3 architecture:
- 5 Infrastructure agents (FileSystem, Shell, Git, Build, Aspire)
- 4 Orchestration agents (PersonalAssistant, Planning, Notification, Deployer)
- 2 Review agents (Reviewer, SelfImprovement)
- 2 Knowledge agents (Knowledge, User)
- 11 message/event types implementing IAgentMessage/IEvent
- 12 grain interfaces extending IAgent

V3 constructor pattern: state, eventLog, chatClient, history, trackingItems
StateDescriptor -> StateEntry, SystemPrompt -> Instructions
IReceiver.Receive -> ReceiveAsync, CanReceive -> CanReceiveAsync

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port RoslynAgent, DotNetAgent, NuGetAgent, and GitHubAgent to V3
constructor pattern. Replace Orleans.DurableJobs with IRemindable for
scheduled tasks. Add IAgentMessage to TestResultMessage and
CodeChangedMessage. Make RegisterToolMethods protected for subclass use.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 6: Created 18 single-line agent test classes inheriting AgentTest<T>
in test/Core.Tests/Agents/. Added project references to Agents and
Agents.CSharp. Updated AgentTestSiloConfigurator with LLM attribute
mappers, IHttpClientFactory, and IGitHubClient mock registrations.

Phase 7: Moved 6 sample agents from src/Core/Samples/ and
src/Core/WeatherAgent.cs to samples/Samples/Agents/ with updated
IAW.Samples.Agents namespace. Renamed conflicting classes
(PersonalAssistantSampleAgent, KnowledgeBaseSampleAgent).

Phase 8: Updated ArchitectureGuardTests to use IAW.Core namespace
instead of Core.V3. Added guards for all agents extending Agent
and no V1/V2 types existing. Updated source file scan path.

Phase 9: Set IAW.Core and IAW.Testing versions to 0.0.1. Updated
CLAUDE.md to remove all V1/V2 references. Cleaned up IAW.Testing
to exclude legacy files (AspireAgentTest, AgentTestV2, Scenario).

All 429 tests pass (18 agents x 20 behavior tests + architecture guards).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix CLAUDE.md IAgent method names to match actual API (no Async suffixes)
- Remove v3- prefix from TestAgent memory keys (history, tracking)
- Fix AllAgentsInIAWAgents_ExtendAgent guard to use IGrain filter instead of tautological Agent filter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Delete dead code: ISelfDiagnosable, DiagnosticReport, AIContext,
  6 marker interfaces, 11 message types, Agent.Conversation.cs,
  TrackingOptions, AgentResponse
- Move GitHub folder from Core to Agents.CSharp, update namespaces
- Remove Octokit from Core.csproj (stays in Agents.CSharp)
- Make scheduled behaviors built-in: StartTrackingAsync registers
  Orleans reminders, StopTrackingAsync unregisters, ReceiveReminder
  dispatches to OnTrackingDueAsync, OnActivateAsync re-registers
- Gut AgentTest<T>: remove all 18 inherited [Fact] tests, keep
  fixture infrastructure only
- Delete 17 empty agent test files and CoreAgentTests.cs
- Rename AgentTests.cs to RegistryTests.cs, keep only registry tests
- Clean MessageTypeTests.cs and StreamNameTests.cs for deleted types
- Remove AllNotificationTypes architecture guard (zero notifications remain)
- Remove ConversationErrors counter and ConversationDuration histogram
- Fix all namespace Core -> IAW.Core across Core, Agents, Agents.CSharp
- Fix duplicate using directives
- All 37 tests pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…minder

- StartTracking/StopTracking tool methods now call StartTrackingAsync/StopTrackingAsync
  instead of bypassing reminder registration
- GitHubAgent and NuGetAgent call base.ReceiveReminder for unrecognized reminders
- Rename IGitHub service interface to IGitHubService to avoid collision with grain interface

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move 22 loose .cs files from src/Core/ root into logical subfolders:
- Agent/ (10 files): base class partials, DynamicAgent, DurableChatHistoryProvider
- Contracts/ (12 files): interfaces, records, and serializable models

No namespace changes — purely file organization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove CapabilityAttribute, PublishesAttribute, SubscribesAttribute,
DevVisibleAttribute and all usages. Agent metadata and registry now
discover publishes/subscribes purely from communication interfaces
(IBroadcaster, INotifier, IReceiver, IStreamConsumer). Drop Capabilities
field from AgentMetadata, AgentRegistration, AgentQuery, and
AgentCapabilities (removed IsMultiState, IsSecure).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…covery

Add four new tests to AgentBasicTests:
- GetCapabilities_HasToolsReflectsActualTools
- GetMetadata_BasicAgent_HasNoPublishesOrSubscribes
- GetMetadata_ReturnsAgentTypeName
- Cancel_ThenRespond_StillWorks

Fix namespace/import issues from v3 refactoring that prevented build:
- DynamicAgent and DurableChatHistoryProvider namespace Core.Agent -> IAW.Core
- ChatMessage disambiguation via using alias
- Missing using Core.AI for LlmAttribute in all agent files
- Missing using Core.Contracts for MemoryAttribute in AgentRegistryGrain
- Missing using Core.Tools and Core.Messages in test files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…actoring

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
LeftTwixWand and others added 13 commits March 17, 2026 18:30
Remove the HelloWorldTest sample project (deleted src/IAW.Assistant/HelloWorldTest/HelloWorldTest.csproj, Program.cs, and result.json). Update .claude/settings.local.json to include "Bash(cat:*)" in the command list. Cleans up an obsolete test project and extends local Claude commands.
- CodeOrchestrationE2ETests uses Orleans TestCluster with real Ollama
- Execute_CreatesHelloWorldProject: verifies full pipeline (LLM → code gen → workspace files)
- Project_AnswersSimpleQuestionDirectly: verifies direct answer without code execution
- Both tests pass with real LLM in ~11 seconds
- Requires: Ollama running with qwen2.5 model (set OLLAMA_HOST env var)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…a queries

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace hardcoded agent list with dynamic discovery from
InterfaceCatalog.Discover(). Agents are grouped by namespace
(domain) so the LLM can pick the most specialized one.
New agents are automatically available without code changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The workspace env var (D:\IAW-Workspace) is a runtime data dir,
not the repo root. Walk up from AppContext.BaseDirectory instead
to find the repo root containing src/IAW.AppHost.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Escape payload keys/values in SendNotificationAsync with plaintext fallback
- Add job.completed stream: deliver scheduled job results to correct topic
- ScheduleJobTool auto-cancels existing jobs with same name (no duplicates)
- Add SendJobResultAsync with proper topic resolution and MarkdownV2 fallback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@LeftTwixWand LeftTwixWand self-assigned this Mar 18, 2026
LeftTwixWand and others added 14 commits March 18, 2026 14:45
…bsite

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add 3 more orphaned messages (SpecReadyEvent, BuildMetricsCollectedEvent, empty CodeChangedEvent)
- Delete redundant cumulative token state tracking from Agent.cs
- Add AgentDiscovery.cs to DynamicAgent removal scope

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t token tracking

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Memory → MemoryAgentBase, LLM → LlmAgentBase
- Add using aliases where needed for TextContent ambiguity
- Zero global:: qualifiers remaining in codebase

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… collection expressions

- Replace [..options] with direct array assignment in UISession and FormTests
- Replace = [] property defaults with Array.Empty<T>() in WidgetState
- Fix LLM→LlmAgentBase and Memory→MemoryAgentBase type references in tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s, context, pub/sub

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ire website

- Replace `using Core.V3;` → `using IAW.Core;` and related namespaces
- Replace all 5-parameter old constructors with `[AgentState]`/`[Llm<T>]` 2-param pattern
- Remove `[Memory("v3-history")]` and `[Memory("v3-tracking")]` parameters (now internal to AgentDurableState)
- Update section headers in reference/index.md (Core.V3 → Core, Core.V3.Messages → Core.Communication.Messages, etc.)
- Remove "V3" from all prose descriptions ("V3 agents" → "agents", "V3 introduces" → "IAW provides", etc.)
- Fix Agent base class signature in reference/index.md to match current 2-param constructor
- Remove `.WithLLMEnvironment(builder)` from AppHost snippets (WithReference does all propagation)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LeftTwixWand LeftTwixWand merged commit c620349 into master Mar 18, 2026
1 check passed
@LeftTwixWand LeftTwixWand deleted the v3 branch March 18, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant