[Feature] Reference another session with @ #2138

Open
opened 2026-02-16 17:34:20 -05:00 by yindo · 6 comments
Owner

Originally created by @veracioux on GitHub (Oct 16, 2025).

Originally assigned to: @thdxr on GitHub.

I think it would be useful to be able to reference a different session using the @ symbol, so that the session's content would be available in the LLM's context.

Some ideas on how this could be implemented:

  1. When creating a session title, also generate a slug using the AI. When typing @<that_slug> the LLM would have that session available in its context.
  2. Generate a friendly but short slug (random or based on the session ID) - something like docker does for containers: vibrant_cray, competent_elgamal, etc. When typing @<that_slug> the LLM would have that session available in its context.
  3. Use the session title after @, e.g. typing @Creat would show a completion window that would list Creating Dockerfile for opencode CLI which you can select. That session would then be available in the LLM's context.

One use case for this that just came up, though I could probably come up with numerous others:

I created a Dockerfile in the OC repo in the packages/opencode directory, but later realized that it would be better to have it in the repo root. I would like to cd to the repo root with the LLM retaining the context, but can't and have to start from scratch or use workarounds.

I volunteer to implement this.

Originally created by @veracioux on GitHub (Oct 16, 2025). Originally assigned to: @thdxr on GitHub. I think it would be useful to be able to reference a different session using the @ symbol, so that the session's content would be available in the LLM's context. Some ideas on how this could be implemented: 1. When creating a session title, also generate a slug using the AI. When typing @<that_slug> the LLM would have that session available in its context. 2. Generate a friendly but short slug (random or based on the session ID) - something like docker does for containers: vibrant_cray, competent_elgamal, etc. When typing @<that_slug> the LLM would have that session available in its context. 3. Use the session title after `@`, e.g. typing `@Creat` would show a completion window that would list `Creating Dockerfile for opencode CLI` which you can select. That session would then be available in the LLM's context. One use case for this that just came up, though I could probably come up with numerous others: I created a Dockerfile in the OC repo in the `packages/opencode` directory, but later realized that it would be better to have it in the repo root. I would like to `cd` to the repo root with the LLM retaining the context, but can't and have to start from scratch or use workarounds. I volunteer to implement this.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 16, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #968: Allow the model to get context from other sessions - This issue discusses linking sessions to share context between them, which is very similar to your @ symbol reference idea
  • #1759: [Feature Request] Fork session - Discusses duplicating session state to new sessions, which relates to session context sharing
  • #2588: Feature request: let subagents inherit context - About inheriting context between different agent threads, which shares the concept of context sharing

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 16, 2025): This issue might be a duplicate of existing issues. Please check: - #968: Allow the model to get context from other sessions - This issue discusses linking sessions to share context between them, which is very similar to your @ symbol reference idea - #1759: [Feature Request] Fork session - Discusses duplicating session state to new sessions, which relates to session context sharing - #2588: Feature request: let subagents inherit context - About inheriting context between different agent threads, which shares the concept of context sharing Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 16, 2025):

was your problem wanting to reference a different session? Or was it just the need to reference files outside cwd

@rekram1-node commented on GitHub (Oct 16, 2025): was your problem wanting to reference a different session? Or was it just the need to reference files outside cwd
Author
Owner

@veracioux commented on GitHub (Oct 16, 2025):

@rekram1-node Both would be nice, but this feature request is about referencing another session. The example was just one use case for the feature (the one that sparked the idea), though probably not the best one. Actually, this feature would address the existing issues the github bot linked, and those issues highlight better use cases than mine.

@veracioux commented on GitHub (Oct 16, 2025): @rekram1-node Both would be nice, but this feature request is about referencing another session. The example was just one use case for the feature (the one that sparked the idea), though probably not the best one. Actually, this feature would address the existing issues the [github bot linked](https://github.com/sst/opencode/issues/3227#issuecomment-3412798736), and those issues highlight better use cases than mine.
Author
Owner

@rekram1-node commented on GitHub (Oct 16, 2025):

yeah not sure how we wanna approach this currently, I think rn the best thing for you would be writing a custom tool that lets the llm search previous sessions if it wants. Later on we will probably have some memory type of thing potentially

i dont think doing an @ reference will be best mechanism here

@rekram1-node commented on GitHub (Oct 16, 2025): yeah not sure how we wanna approach this currently, I think rn the best thing for you would be writing a custom tool that lets the llm search previous sessions if it wants. Later on we will probably have some memory type of thing potentially i dont think doing an @ reference will be best mechanism here
Author
Owner

@iamhenry commented on GitHub (Nov 11, 2025):

would a plugin be able to search the local db to accomplish this?

@iamhenry commented on GitHub (Nov 11, 2025): would a plugin be able to search the local db to accomplish this?
Author
Owner

@rekram1-node commented on GitHub (Nov 11, 2025):

I think you'd be better off wrapping the sdk and making custom tools to search through sessions (which qualify as plugins) but yeah to some degree u could, tho we dont have a plugin for some parts that u may want like @ completions plugins

@rekram1-node commented on GitHub (Nov 11, 2025): I think you'd be better off wrapping the sdk and making custom tools to search through sessions (which qualify as plugins) but yeah to some degree u could, tho we dont have a plugin for some parts that u may want like @ completions plugins
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2138