agentleFS
intelligencedevintelligencedev/manifold/AGENTS.md

manifold

AGENTS.md501 starsChanged 6 months agoMITView on GitHub

Source lives in internal/ (e.g., internal/agent, internal/orchestrator); keep new packages focused on one concern and avoid import cycles. CLI/Server entrypoints sit under cmd/ with binaries for the agent, HTTP server (manifold, implemented in cmd/agentd), and embedctl (if present). Docs reside in docs/, assets in assets/, and deployment scaffolding in docker/, configs/, and top-level example.env. Co-locate tests with their packages and share fakes through internal/testhelpers. Follows Go's concurrency mantra: "Don't communicate by sharing memory; share memory by communicating." The channel becomes…

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep packages small and focused on a single responsibility.

    line 11
  2. Distinctive:

    Avoid cyclical dependencies.

    line 12
  3. Very specific:

    Use constructor functions (e.g., NewService(...)) to inject dependencies.

    line 17
  4. Distinctive:

    Every exported function and method must have unit tests.

    line 146
  5. Very specific:

    Use Go’s built‑in testing package with stretchr/testify for assertions and mocks, or gomock if interfaces are extensive.

    line 150
  6. Distinctive:

    Prefer table‑driven tests for clarity and coverage.

    line 151
  7. Very specific:

    Call t.Parallel() where safe to speed up the suite.

    line 152

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Go/manifold

Coding Conventions

Project Structure & Module Organization

Source lives in internal/ (e.g., internal/agent, internal/orchestrator); keep new packages focused on one concern and avoid import cycles. CLI/Server entrypoints sit under cmd/ with binaries for the agent, HTTP server (manifold, implemented in cmd/agentd), and embedctl (if present). Docs reside in docs/, assets in assets/, and deployment scaffolding in docker/, configs/, and top-level example.env. Co-locate tests with their packages and share fakes through internal/testhelpers.

Package Organization

  • Keep packages small and focused on a single responsibility.
  • Avoid cyclical dependencies; extract interfaces when necessary.

Dependency Injection

  • Promote testability via interface‑driven design.
  • Use constructor functions (e.g., NewService(...)) to inject dependencies.

Concurrency

Follows Go's concurrency mantra: "Don't communicate by sharing memory; share memory by communicating." The channel becomes the synchronization point.

Essential Go CLI Tools

The following Go command-line tools are essential for development, testing, and maintenance in this project. Use them as described to ensure code quality and consistency:

ToolPurpose
go buildCompiles packages and their dependencies into an executable.
go runCompiles and runs the specified Go program.
go fmtFormats Go source code according to the language's style guidelines.
gofmtStandalone formatter; also available as an executable.
go testRuns tests and benchmarks. Use -coverprofile with go tool cover to analyze test coverage.
go vetExamines Go source code and reports suspicious constructs that could be bugs.
go docExtracts and generates documentation for Go packages.
go getAdds, updates, or removes dependencies in the go.mod file.
go modProvides access to module operations (e.g., go mod tidy to clean up dependencies).
go toolRuns the specified Go tool (see below for examples).
cgoEnables the creation of Go packages that call C code.
pprofFor profiling Go programs.
fixRewrites Go programs that use old language and library features.

Tip: Refer to this table whenever you need to build, test, format, or analyze Go code in this project.

Coding Style & Naming Conventions

Target Go 1.26.3 and keep files gofmt clean with tabs. Maintain import order with goimports and keep golangci-lint run (via make lint) silent. Name packages after their capability, keep filenames lowercase, and export concise CamelCase APIs. Prefer constructor-style functions (e.g., NewService) for dependency injection.

Naming Conventions

  • Identifiers: use camelCase for unexported names and PascalCase for exported names; avoid snake_case and SCREAMING_SNAKE_CASE.
  • Acronyms and initialisms: keep casing consistent (APIKey, userID, HTTPClient); avoid mixed forms such as ApiKey or userId.
  • Letters: prefer ASCII identifiers; avoid non-ASCII names unless there is a strong reason.
  • Conflicts: do not use names that clash with Go builtins or imported standard library package names.
  • Type words: usually omit the type from the identifier unless it is needed to distinguish a converted value.
  • Exporting: keep identifiers unexported by default; export only when required by package boundaries or external use.
  • Length: use short names for very local scope and more descriptive names as scope widens.
  • Packages: use lowercase ASCII only; keep names short, descriptive, and usually one word. Multiword package names should be concatenated lowercase with no separator.
  • Packages: avoid standard library package names, invisible prefixes (. / _), special directories (vendor, testdata, internal), and vague catch-all names such as util or helpers.
  • Files: prefer a single lowercase word; if a filename is multiword, stay consistent with the surrounding codebase. Avoid special prefixes or suffixes unless intentional.
  • Chatter: avoid repeating the package name in exported functions, types, or methods.
  • Receivers: use a short, consistent receiver name; avoid this, self, and me.
  • Getters and setters: prefer plain method names for getters; use SetX for setters.
  • Interfaces: one-method interfaces usually end in -er, such as Reader, Writer, or Stringer.

IMPORTANT: Always Format Modified Go Files

After editing ANY Go file, you MUST run go fmt on that file before considering the task complete.

# Format a single modified file
go fmt path/to/file.go

# Format multiple files
go fmt internal/agent/engine.go internal/agent/memory/evolving.go

# Format an entire package
go fmt ./internal/agent/...

This ensures consistent code style and prevents formatting-related issues. Non-formatted code will fail CI checks.

Go Language Features (1.22+)

featuremicro-example
loop-var capture fixedfor _,v:=range xs{ go func(x string){println(x)}(v) }
integer rangesfor i:=range 10{ println(9-i) }
slices.Concatall:=slices.Concat(a,b,c)
database/sql.Null[T]var n sql.Null[int64]; rows.Scan(&n); if n.Valid{use(n.V)}
math/rand/v2import r "math/rand/v2"; v:=r.IntN(10)
HTTP patternsmux.Handle("GET /task/{id}", h)
featuremicro-example
iterator rangefor v:=range slices.Values([]int{1,2,3}){fmt.Println(v)}
generic type aliastype Vec[T]=[]T // GOEXPERIMENT=aliastypeparams
unique internh:=unique.Make(s); m[h]=val
timers GC+0-capt:=time.NewTimer(d); <-t.C /* cap(t.C)==0 */
telemetry$ go telemetry on
go env -changed$ go env -changed
featuremicro-example
generic alias GAtype Map[K comparable,V any]=map[K]V
Swiss-table maps(automatic, no code)
weak ptr + cleanupw:=weak.Make(obj); runtime.AddCleanup(&obj,free)
dir-scoped FSr,_:=os.OpenRoot("/data"); r.Open("foo.txt")
testing.B.Loopfunc BenchmarkX(b *testing.B){ for b.Loop(){ x() } }
FIPS/crypto pkgskey:=hkdf.Extract(...); _,_ = mlkem.GenerateKey(nil)
go:wasmexport//go:wasmexport add\nfunc add(a,b int)int{return a+b}

Understand that Go ≥1.22 adds safer loop vars, integer/iterator ranges, generic type aliases, Swiss-maps, weak pointers, os.Root, testing.B.Loop, new crypto/FIPS pkgs, etc. See tables above for one-liner idioms.


// ROUTING — Go 1.23

mux.Handle("GET /item/{id}", h)               // ServeMux: method + wildcard ★1
log.Print(r.Pattern)                          // Request.Pattern ★2
http.SetCookie(w,&http.Cookie{                // Quoted + Partitioned cookies ★3
  Name:"sid", Value:`"x"`, Quoted:true, Partitioned:true})
dup := r.CookiesNamed("sid")                  // get all "sid" cookies ★3
vals,_ := http.ParseCookie(`a=1; a=2`)        // ParseCookie helper ★4
c,_   := http.ParseSetCookie(`u=1; Path=/`)   // ParseSetCookie helper ★4
req := httptest.NewRequestWithContext(ctx,    // context-aware test request ★5
        http.MethodGet,"/",nil)

// ROUTING — Go 1.24
tr  := &http.Transport{MaxResponseHeaderBytes:64<<10}        // size-based 1xx cap ★6
srv := &http.Server{Handler:mux,                             // protocol matrix + h2c ★7
       Protocols:[]http.Protocol{http.UnencryptedHTTP2},
       HTTP2:&http2.Server{IdleTimeout:time.Minute}}         // HTTP/2 tuning ★7
tr.Protocols = []http.Protocol{http.UnencryptedHTTP2}        // client side ★7

// TESTING — Go 1.24
func BenchmarkFoo(b *testing.B){ for b.Loop(){ foo() } }     // testing.B.Loop ★8
func TestFoo(t *testing.T){ t.Chdir(tmp); work(t.Context()) }// T/B.Chdir & Context ★9
synctest.Run(func(ctx context.Context){                      // deterministic bubble ★10
  go work(ctx); synctest.Wait()
})

Testing Requirements

Every exported function and method must have unit tests. Aim for ≥ 80 % coverage on business logic.

Testing Conventions

  • Use Go’s built‑in testing package with stretchr/testify for assertions and mocks, or gomock if interfaces are extensive. |
  • Prefer table‑driven tests for clarity and coverage. |
  • Call t.Parallel() where safe to speed up the suite. |
  • Generate mocks via mockgen or counterfeiter. |
  • Include benchmarks for performance‑critical code (go test -bench). |

Common Commands

# Run all unit tests
go test ./...

# Run tests with race detector
go test -race ./...

# Run tests with coverage
go test -cover ./...

# Continuous profiling (CPU & memory)
go test -run=^$ -bench=. -benchmem ./...

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.