Skill for developing AI agent engine components in internal/agent/. Covers the ReAct loop, swarm delegation, planning, verification, memory reflection, and cron automation.
中文简介正在准备中。当前显示原文说明。
Skill for writing and running tests for ActonOS. Covers unit tests, integration tests, test patterns, mocking, and coverage.
中文简介正在准备中。当前显示原文说明。
安装前可以查看交给 AI 代理的指令内容。
Use this skill when writing or running tests for ActonOS.
| Category | Location | Build Tag | Command |
|---|---|---|---|
| Unit Tests | internal/**/*_test.go | (none) | make test-unit |
| Integration Tests | *_os_test.go / *_integ_test.go under internal/ | integration | make test-integ |
| Benchmark Eval Suite | evals/ (30+ tasks) | (none) | ./evals/run.sh / .\evals\run.ps1 |
| E2E / Smoke Tests | web/tests/*.spec.ts | (none) | cd web && npm run test:e2e |
| Frontend Unit | web/src/**/*.test.{ts,tsx} | (none) | cd web && npm test |
| Frontend Browser | web/tests/*.spec.ts | (none) | cd web && npm run test:e2e |
| Frontend Quality | web/ | (none) | cd web && npm run quality |
# All tests
make test
# Unit tests only (fast, no external dependencies)
make test-unit
# Equivalent to: CGO_ENABLED=0 go test -count=1 -coverprofile=build/coverage.out ./internal/...
# then go run ./scripts/cover-gate.go build/coverage.out
# Cognition & Reliability Benchmark Suite (30 tasks, CI gate)
./evals/run.sh
# on Windows PowerShell:
.\evals\run.ps1
# Live model benchmark evaluation
go run ./evals/runner/main.go --mode=live --model=anthropic/claude-sonnet-4.5 --output=eval_report.md --fail-under=90.0
# Integration tests
make test-integ
# Equivalent to: CGO_ENABLED=0 go test -count=1 -tags=integration ./internal/...
# Specific package
go test -v ./internal/agent/...
# Specific test
go test -v -run TestDecayScore ./internal/memory/...
# With coverage
go test -coverprofile=build/coverage.out ./internal/...
go tool cover -html=build/coverage.out -o build/coverage.html
# Frontend lint, locale parity, strict visible-text audit, Vitest, build,
# bundle budget, Playwright smoke tests, and axe accessibility checks
cd web
npm run quality
npx tsc --noEmit
# Playwright smoke test (requires a running ActonOS server)
npm run test:e2e
Frontend mutation tests must cover 202 approval_required separately from
successful completion. Realtime tests must verify malformed-frame handling,
reconnect behavior, and shared snapshot consumption. Modal tests must assert
dialog semantics and asynchronous close behavior.
npm run quality must execute the hardcoded text audit with --fail and the
Playwright suite. Browser tests must use axe and reject serious or critical
accessibility violations. Production frontend lint must reject explicit any
and unused variables.
func TestDecayScore(t *testing.T) {
tests := []struct {
name string
elapsed time.Duration
lambda float64
weight float64
expected float64
}{
{
name: "recent_memory_high_score",
elapsed: 1 * time.Hour,
lambda: 24.0,
weight: 1.0,
expected: 0.959,
},
{
name: "old_memory_decayed",
elapsed: 72 * time.Hour,
lambda: 24.0,
weight: 1.0,
expected: 0.049,
},
{
name: "zero_elapsed_full_score",
elapsed: 0,
lambda: 24.0,
weight: 1.0,
expected: 1.0,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := decay.Score(tt.elapsed, tt.lambda, tt.weight)
if math.Abs(got-tt.expected) > 0.01 {
t.Errorf("Score(%v, %v, %v) = %v, want %v",
tt.elapsed, tt.lambda, tt.weight, got, tt.expected)
}
})
}
}
Define interfaces in production code, implement mocks in tests:
// internal/llm/provider.go (production)
type LLMProvider interface {
Complete(ctx context.Context, messages []Message, opts Options) (*Response, error)
StreamComplete(ctx context.Context, messages []Message, opts Options) (<-chan Token, error)
}
// internal/llm/provider_test.go (test)
type MockLLMProvider struct {
CompleteFunc func(ctx context.Context, messages []Message, opts Options) (*Response, error)
CompleteCalled int
}
func (m *MockLLMProvider) Complete(ctx context.Context, messages []Message, opts Options) (*Response, error) {
m.CompleteCalled++
if m.CompleteFunc != nil {
return m.CompleteFunc(ctx, messages, opts)
}
return &Response{Content: "mock response"}, nil
}
func NewMockLLM(response *Response) *MockLLMProvider {
return &MockLLMProvider{
CompleteFunc: func(_ context.Context, _ []Message, _ Options) (*Response, error) {
return response, nil
},
}
}
// internal/testutil/helpers.go
package testutil
func NewTestDB(t *testing.T) *memory.DB {
t.Helper()
dir := t.TempDir()
db, err := memory.Open(filepath.Join(dir, "test.db"))
if err != nil {
t.Fatalf("failed to open test DB: %v", err)
}
t.Cleanup(func() { db.Close() })
return db
}
func NewTestServer(t *testing.T) *server.Server {
t.Helper()
db := NewTestDB(t)
mgr := agent.NewManager(db)
return server.New(mgr, db)
}
//go:build integration
package integration_test
import (
"context"
"testing"
"d:/Projects/ActonOS/internal/memory"
)
func TestHybridSearch_FTS5AndVector(t *testing.T) {
db := testutil.NewTestDB(t)
hybrid := memory.NewHybridSearch(db)
// Seed test data
ctx := context.Background()
hybrid.Index(ctx, "doc1", "ActonOS is an AI agent operating system")
hybrid.Index(ctx, "doc2", "Docker containers run on Alpine Linux")
hybrid.Index(ctx, "doc3", "The agent engine uses ReAct loop for reasoning")
// Search
results, err := hybrid.Search(ctx, "AI agent reasoning", 2)
if err != nil {
t.Fatalf("Search() error: %v", err)
}
if len(results) != 2 {
t.Fatalf("expected 2 results, got %d", len(results))
}
// First result should be the most relevant
if results[0].DocID != "doc3" && results[0].DocID != "doc1" {
t.Errorf("unexpected top result: %s", results[0].DocID)
}
}
func TestHandleListAgents(t *testing.T) {
srv := testutil.NewTestServer(t)
// Create test agent
ctx := context.Background()
srv.AgentManager.Create(ctx, agent.Manifest{Name: "Test Agent"})
// Make request
req := httptest.NewRequest("GET", "/api/agents", nil)
req.Header.Set("Authorization", "Bearer test-token")
w := httptest.NewRecorder()
srv.ServeHTTP(w, req)
if w.Code != 200 {
t.Fatalf("expected 200, got %d", w.Code)
}
var resp struct {
Data struct {
Agents []agent.Manifest `json:"agents"`
} `json:"data"`
}
json.NewDecoder(w.Body).Decode(&resp)
if len(resp.Data.Agents) != 1 {
t.Errorf("expected 1 agent, got %d", len(resp.Data.Agents))
}
}
| Package | Target | Priority |
|---|---|---|
internal/memory/ | 80%+ | Critical (data integrity) |
internal/agent/ | 70%+ | High (core logic) |
internal/auth/ | 80%+ | Critical (security) |
internal/server/ | 60%+ | Medium (handlers) |
internal/plugin/ | 70%+ | High (WASM sandbox) |
internal/channels/ | 70%+ | High (pairing/routing) |
internal/tools/ | 60%+ | Medium |
internal/sandbox/ | 70%+ | High (security) |
internal/security/ | 90%+ | Critical |
internal/
├── agent/
│ ├── engine.go
│ ├── engine_test.go ← Unit tests
│ └── engine_integ_test.go ← Integration tests (build tag)
├── memory/
│ ├── decay.go
│ └── decay_test.go ← Unit tests
Changes touching tools, agents, workspace APIs, MCP, or sandboxing must test:
data: SSE JSON-RPC responses.Security package target: internal/security/ must maintain at least 90% coverage.
The autonomous-kernel baseline established on 2026-08-18 is: agent 71.5%, server 60.6%, tools 60.3%, sandbox 87.8%, security 92.3%, and memory 83.3%. Changes must not reduce a package below its target.
Linux CI must run CGO_ENABLED=1 go test -race -count=1 ./internal/....
Provider-storage tests must prove secrets are absent from metadata files,
legacy plaintext is migrated and removed, and Vault deletion works. Backup
tests must query committed WAL data from the downloaded snapshot.
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Skill for developing AI agent engine components in internal/agent/. Covers the ReAct loop, swarm delegation, planning, verification, memory reflection, and cron automation.
中文简介正在准备中。当前显示原文说明。
Skill for developing REST API endpoints in internal/server/. Covers routing, request validation, WebSocket streaming, and API conventions.
中文简介正在准备中。当前显示原文说明。
Skill for building ActonOS: Web UI → Go binary → Docker image → ISO. Covers the entire build pipeline.
中文简介正在准备中。当前显示原文说明。
Skill for developing messaging channel adapters via WASM Plugins and managing routing, session state, pairing codes, and accounts in internal/channels/.
中文简介正在准备中。当前显示原文说明。
Skill for developing the ActonOS React 19 + Tailwind v4 frontend adhering to the official DESIGN.md specification. Covers design tokens, component decomposition, zero-hardcoded-text i18n, and go:embed delivery.
中文简介正在准备中。当前显示原文说明。
Skill for creating ActonOS releases. Covers version bumping, changelog management, git tagging, Docker image publishing, and ISO creation.
中文简介正在准备中。当前显示原文说明。