{"modulePath":"github.com/memcode-ai/memcode","version":"v0.56.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package secrets\n\nPackage secrets keeps the agent from leaking credentials. The agent may USE secrets (commands inherit the process environment, including values loaded from .env) but their values must never reach the model, the event log, or the terminal. Two defenses: refuse to read secret-bearing files, and redact known secret values from every tool result and printed line.\n\n## Functions\n\n```go\nfunc ChildEnv(env []string) []string\n```\nChildEnv returns env (os.Environ() when nil) without memcode's own credentials, for every process memcode starts on the user's or model's behalf.\n\n```go\nfunc IsSecretPath(path string) bool\n```\nIsSecretPath reports whether a path likely holds credentials, so its VALUES should be masked when read or diffed (the file is still usable — the agent just operates on it by reference, never seeing the plaintext).\n\n```go\nfunc RedactSecretDiff(diff string) string\n```\nRedactSecretDiff masks the changed and context lines of every credential file in a unified diff, leaving headers and other files intact.\n\n```go\nfunc RedactSecretFile(content string) string\n```\nRedactSecretFile masks the values in a credential-bearing file (or a diff of one), preserving structure so the agent can still reason about and edit it.\n\n```go\nfunc RedactSecretGrep(out, searched string) string\n```\nRedactSecretGrep masks matched lines that come from credential files in grep/rg output (\"path:line:text\", or \"line:text\" when one file was searched). searched is the path the search was scoped to.\n\n```go\nfunc SensitiveName(name string) bool\n```\nSensitiveName reports whether an environment variable's NAME marks its value as a secret.\n\n## Types\n\n```go\ntype Redactor struct {\n\t// contains filtered or unexported fields\n}\n```\nRedactor replaces known secret values with a placeholder.\n\n```go\nfunc NewFromEnv() *Redactor\n```\nNewFromEnv collects secret values from the current environment (which, for the agent, already includes anything loaded from .env).\n\n```go\nfunc (r *Redactor) Add(values ...string)\n```\nAdd registers extra secret values to redact.\n\n```go\nfunc (r *Redactor) Redact(s string) string\n```\nRedact replaces every known secret value found in s with the placeholder.\n\n","path":"github.com/memcode-ai/memcode/internal/agent/secrets","name":"secrets","synopsis":"Package secrets keeps the agent from leaking credentials.","isRedistributable":true}
