Nothing in the tree could be renamed, moved or removed, and an approved person stayed in the project they were first put in — from the web or the CLI. Now: - /admin/users is the tree, each project opening onto its people and keys, with approve, move, suspend, reinstate and remove for people, revoke for keys, and add, rename, move and remove at every level, plus a search over every account. Forms post and get the page back, so it works with no script; htmx 2.0.11 (0BSD, embedded, checked against npm's integrity hash) swaps only the changed part, keeping open projects open. - llmgw org tree/add/rename/move/remove, users move/delete, and keys list --all. - Projects, teams and organizations are named by id, path (Acme/platform/gateway) or unique name; users by id or email. With a single project --project can be left out, instead of defaulting to "default", which a tree built from the web does not have. Moving a person moves the keys they made; operator keys stay with the project. Only empty things are removed, and never a project that had a key, since usage history refers to it. Also: keys init no longer reparents an existing team or project; reinstating an account with no project is refused (a rejected signup used to come back active and fail at its first key); rejecting a signup removes it; keys limits --budget takes whole units like the quotas page. Checked in headless Chrome: a move from an open project updates the page in place, keeps the project open, and the search still filters. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
68 lines
2.1 KiB
Go
68 lines
2.1 KiB
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// newMemoryCmd turns note storage on for a project, or off.
|
|
//
|
|
// A command rather than a configuration key for the same reason threads are:
|
|
// keeping what an agent decided to remember is a decision about data, not about
|
|
// deployment, and it should look like an act rather than a default nobody read.
|
|
func newMemoryCmd(open opener) *cobra.Command {
|
|
var (
|
|
project string
|
|
hours int
|
|
off bool
|
|
)
|
|
|
|
cmd := &cobra.Command{
|
|
Use: "memory",
|
|
Short: "Keep notes an agent writes for itself, across conversations",
|
|
Long: "With this on, an agent can save and search notes through /v1/memory or the\n" +
|
|
"MCP tools at /mcp (remember, recall, forget), and find them again in later\n" +
|
|
"conversations.\n\n" +
|
|
"Off for every project until this is run. The retention is required: notes\n" +
|
|
"expire that many hours after they were last written, so a store nobody\n" +
|
|
"chose a number for does not keep everything forever.",
|
|
Args: cobra.NoArgs,
|
|
RunE: func(cmd *cobra.Command, _ []string) error {
|
|
if !off && hours <= 0 {
|
|
return fmt.Errorf("--retain-hours is required: say how long notes are kept, or pass --off")
|
|
}
|
|
s, err := open(cmd.Context())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer s.Close()
|
|
|
|
keep := hours
|
|
if off {
|
|
keep = 0
|
|
}
|
|
p, err := resolveProject(cmd.Context(), s, project)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
project = p.Path
|
|
if err := s.SetMemoryRetention(cmd.Context(), p.ID, keep); err != nil {
|
|
return err
|
|
}
|
|
if keep == 0 {
|
|
fmt.Fprintf(cmd.OutOrStdout(),
|
|
"%s keeps no notes. Existing ones are removed at the next prune.\n", project)
|
|
return nil
|
|
}
|
|
fmt.Fprintf(cmd.OutOrStdout(),
|
|
"%s keeps notes for %d hours after they were last written.\n", project, keep)
|
|
return nil
|
|
},
|
|
}
|
|
cmd.Flags().StringVar(&project, "project", "", "project: id, path or unique name")
|
|
cmd.Flags().IntVar(&hours, "retain-hours", 0, "how long a note is kept after it was last written")
|
|
cmd.Flags().BoolVar(&off, "off", false, "stop keeping notes for this project")
|
|
return cmd
|
|
}
|