Skip to content

feat: import seekmoon conversation history - #22

Open
chaijie2018 wants to merge 1 commit into
EverMind-AI:mainfrom
chaijie2018:feat/import-seekmoon-history
Open

chaijie2018 wants to merge 1 commit into
EverMind-AI:mainfrom
chaijie2018:feat/import-seekmoon-history

Conversation

@chaijie2018

Copy link
Copy Markdown

Summary

Adds a SeekMoon reader to evercli import conversations, so conversations a user already had in SeekMoon can seed EverMe memory instead of starting empty. It is the importer counterpart of #20 (the same platform's installer).

Unlike every other host here, SeekMoon keeps one transcript per conversation inside the workspace it belongs to, not in a home directory:

<workspace>/.openseek/sessions/<session-id>/openseek_session-<session-id>.jsonl

so the scan roots come from SeekMoon's own workspace registry (~/.openseek/workspaces.json) rather than a fixed path.

⚠️ scan works today; run needs the platform's agent token

  • evercli import conversations scan --platform seekmoon is local-only and works now.
  • run uploads with the target platform's evt, resolved from the token plugin install seekmoon writes into host-mcp.json. That install is refused by the backend today (platform: seekmoon does not validate as known_platform), so uploading needs the same backend change as feat: add seekmoon as a plugin install target #20.

Rather than surface a bare file error, the resolver names both ways to get a credential:

resolve evt for seekmoon: read seekmoon config …/host-mcp.json: no such file or directory;
run `evercli plugin install seekmoon` (it needs the EverMe backend to accept the seekmoon platform),
or add EVERME_AGENT_TOKEN to mcpServers["everme-memory"].env in …/host-mcp.json

Changes

  • cli/internal/importer/conversation/seekmoon.go — the scanner. Scan walks each workspace's .openseek/sessions for openseek_session-*.jsonl (skipping the jobs/ and scratch/ subdirectories), Read streams the transcript.
  • cli/internal/importer/conversation/types.go, platforms.go, registry.go — register seekmoon: platform id, known-platform set, default registry, and DefaultRoots (workspace registry, with EVERCLI_SEEKMOON_WORKSPACES / EVERCLI_SEEKMOON_HOME overrides for tests).
  • cli/internal/importer/conversation/evt.go — resolveSeekMoonEvt plus seekMoonRuntimeDir, mirroring cli/internal/plugin/seekmoon.go.
  • cli/cmd/imports/conversations.go — the two "Use one of: …" hints now come from conversation.PlatformList(); the list had been duplicated at both call sites and would have gone stale with a new platform.
  • cli/internal/importer/conversation/seekmoon_test.go, testdata/seekmoon_sample.jsonl — six test functions, nine cases.
  • CHANGELOG.md.

What gets imported

The transcript is JSONL: a header line (version, id, system_prompt) followed by {"sequence":N,"ts":ms,"item":{"kind":"…","payload":{…}}} records.

Record Handling
user role user; content, truncated to 8000 runes and redacted
assistant role assistant; prose and its tool_calls on one message, so a call stays next to what asked for it. A turn with only reasoning_content is skipped
tool_result role tool, paired by tool_call_id; a missing id is a warning
runtime_notice, terminal skipped — app bookkeeping (background-job notices, turn state)
header system_prompt dropped: it is instructions, not conversation. id becomes the origin of conversationId, so re-imports address the same session

An unknown kind or a malformed line becomes a warning on the conversation, never a failed session.

Test Plan

go1.27.3, darwin/arm64, commit 9917601:

go build ./...                                          exit 0
gofmt -l .                                              (no output)
go vet ./...                                            exit 0
go test -race -count=1 ./internal/importer/... ./cmd/imports/...   ok
go test -run SeekMoon -v ./internal/importer/conversation/         9/9 PASS
  • CLI tests pass, if cli/ changed — the commands above, race detector on
  • Plugin workspace tests pass, if plugins/ changed — not applicable, this PR does not touch plugins/
  • Manual verification completed, if behavior changed — see below

Manual checks against this machine's own data:

  • A backdated copy of a real 2.4 MB / 863-line SeekMoon transcript scans as one item: messages: 1012, toolCalls: 498, status: ready, grouped under ("all sessions").
  • The live conversation is correctly excluded as skippedActive (the shared "file is still being written" rule every platform uses).
  • With the runtime directory pointed at an empty temp dir — so nothing could be uploaded — run fails at credential resolution with the actionable message quoted above.

Security

  • No real emk_*, evt_*, cookies, private URLs, or production logs are included — the fixture uses synthetic timestamps and ids, and the tests build their configs in temp directories.

Related Issues

SeekMoon keeps one JSONL transcript per conversation inside the workspace
it belongs to (<workspace>/.openseek/sessions/<id>/openseek_session-<id>.jsonl),
so unlike every other platform here there is no single home directory to scan:
the roots come from the desktop's own ~/.openseek/workspaces.json.

Read maps what the user saw: `user`, `assistant` (prose and its tool calls kept
on one message) and `tool_result` (paired by tool_call_id). `runtime_notice`,
`terminal` and the assistant's `reasoning_content` are app bookkeeping and are
skipped; an unknown kind or a malformed line becomes a warning, never a failed
session.

Uploading needs the platform's agent token, which the seekmoon installer writes
into host-mcp.json. Until the backend accepts the platform, the resolver says so
and names both ways to supply one, instead of failing with a bare path error.
The "Use one of: ..." hint in the import commands now comes from the registry
rather than a repeated literal at two call sites.

Co-Authored-By: SeekMoon <seekmoon@moonbitlang.com>
@chaijie2018

Copy link
Copy Markdown
Author

Same first-contribution situation as #20: the CI run here is sitting in action_required, so a maintainer will need to approve it when convenient. Nothing else blocks it from my side — locally the same commands CI runs all pass (go build ./..., gofmt -l ., go vet ./..., go test -race -count=1 ./internal/importer/... ./cmd/imports/...), and a backdated copy of this machine's real 2.4 MB transcript scans as messages: 1012, toolCalls: 498, status: ready.

On the dependency with #20 — this shares that PR's backend gap rather than adding a new one:

The two are therefore independent to review and land, but only together do they produce the end-to-end flow: install → import → steady-state memory. If it is easier for you to review them as one change, I am happy to fold this into #20 instead — just say which you prefer. The platform-id question from #20 (seekmoon vs openseek) applies here too; renaming is one constant plus the registry entries.

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