{"_id":"@a-ruban/openclaw-load-previous","_rev":"2-cdd7b4f88bd1765362d9de3be07a82e7","name":"@a-ruban/openclaw-load-previous","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@a-ruban/openclaw-load-previous","version":"1.0.0","keywords":["openclaw","openclaw-plugin","context","history","messages"],"author":{"name":"Oleksandr Ruban"},"license":"MIT","_id":"@a-ruban/openclaw-load-previous@1.0.0","maintainers":[{"name":"a-ruban","email":"alexander.ruban98@gmail.com"}],"homepage":"https://github.com/a-ruban/openclaw-load-previous#readme","bugs":{"url":"https://github.com/a-ruban/openclaw-load-previous/issues"},"dist":{"shasum":"c8ce8fa47171fb6f819d633f9926299acce33738","tarball":"https://registry.npmjs.org/@a-ruban/openclaw-load-previous/-/openclaw-load-previous-1.0.0.tgz","fileCount":4,"integrity":"sha512-gaW3HEs+O6dLdFkHYlOitLrF0IM72Trgz0+HV47a8zZgEG3rFxK3o6ATPOom4OvEiS2ClGQpTWidb3FeeGuA1g==","signatures":[{"sig":"MEUCIFEosaK39/JctdGm1X77m1AzncM8rmWlxZWNNR9bOrq+AiEA6DHwfa05Zahue20IeT9e16vVysofjEVDY028AW4fF8E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10901},"type":"module","_npmUser":{"name":"a-ruban","email":"alexander.ruban98@gmail.com"},"openclaw":{"extensions":["./index.ts"]},"repository":{"url":"git+https://github.com/a-ruban/openclaw-load-previous.git","type":"git"},"_npmVersion":"11.7.0","description":"OpenClaw plugin to load previous conversation messages into model context via /load_previous command","directories":{},"_nodeVersion":"25.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/openclaw-load-previous_1.0.0_1771525768201_0.24399656494800603","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@a-ruban/openclaw-load-previous","version":"1.0.1","description":"OpenClaw plugin to load previous conversation messages into model context via /load_previous command","type":"module","license":"MIT","author":{"name":"Oleksandr Ruban"},"repository":{"type":"git","url":"git+https://github.com/a-ruban/openclaw-load-previous.git"},"keywords":["openclaw","openclaw-plugin","context","history","messages"],"openclaw":{"extensions":["./index.ts"]},"_id":"@a-ruban/openclaw-load-previous@1.0.1","bugs":{"url":"https://github.com/a-ruban/openclaw-load-previous/issues"},"homepage":"https://github.com/a-ruban/openclaw-load-previous#readme","_nodeVersion":"25.4.0","_npmVersion":"11.7.0","dist":{"integrity":"sha512-SZLuEZwgzT+PeI2JOOqRlIMx9sVD1FKkwBsJc7iMHvs201vn40GmnkDNl6ihCnErKFZjjH2JcGWASzUFlkN1dg==","shasum":"a8986e0c7eeb5c72eb0a7e741ad4e3e7d91f8b56","tarball":"https://registry.npmjs.org/@a-ruban/openclaw-load-previous/-/openclaw-load-previous-1.0.1.tgz","fileCount":4,"unpackedSize":11187,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBBO04GbQFIemNjSR8ZiYfhpgquwv3ES74jLFaqLWZ0dAiBxHnXn3ZKGXqq5jDktPCv7PAzhtYphAgXtTOTvwBZrUQ=="}]},"_npmUser":{"name":"a-ruban","email":"alexander.ruban98@gmail.com"},"directories":{},"maintainers":[{"name":"a-ruban","email":"alexander.ruban98@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-load-previous_1.0.1_1771527172897_0.1201429951253774"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-19T18:29:28.093Z","modified":"2026-02-19T18:52:53.205Z","1.0.0":"2026-02-19T18:29:28.344Z","1.0.1":"2026-02-19T18:52:53.079Z"},"bugs":{"url":"https://github.com/a-ruban/openclaw-load-previous/issues"},"author":{"name":"Oleksandr Ruban"},"license":"MIT","homepage":"https://github.com/a-ruban/openclaw-load-previous#readme","keywords":["openclaw","openclaw-plugin","context","history","messages"],"repository":{"type":"git","url":"git+https://github.com/a-ruban/openclaw-load-previous.git"},"description":"OpenClaw plugin to load previous conversation messages into model context via /load_previous command","maintainers":[{"name":"a-ruban","email":"alexander.ruban98@gmail.com"}],"readme":"# openclaw-load-previous\n\nOpenClaw plugin that loads previous conversation messages into model context via the `/load_previous` slash command.\n\n## Why?\n\nAfter `/new` or `/reset`, the model loses all conversation history. This plugin lets you reload previous messages back into context — across session resets.\n\n## Install\n\n```bash\nopenclaw plugins install @a-ruban/openclaw-load-previous\n```\n\nThen restart the gateway:\n\n```bash\nopenclaw gateway restart\n```\n\n## Usage\n\n```\n/load_previous 50\n```\n\nThis loads the last 50 user/assistant messages from the current chat/topic into context. The messages are injected via `prependContext` on your next message — the model sees them natively in its context window.\n\n## How it works\n\n1. **`/load_previous <count>`** — Command handler reads all session JSONL files for the current chat/topic (including `.reset.*` backups from previous sessions), extracts the last N messages, and saves them to a state file.\n\n2. **Next message** — The `before_prompt_build` hook fires, reads the state file, and injects the loaded history via `prependContext`. The model sees the full conversation history as if it was always there.\n\n## Features\n\n- **Cross-session**: Merges messages from multiple session files, including reset backups\n- **Topic-aware**: Automatically scopes to the correct Telegram forum topic\n- **Clean output**: Strips envelope metadata from user messages, skips heartbeats and NO_REPLY\n- **Auto-expiry**: Pending loads expire after 5 minutes\n- **No model involvement**: Chat ID and topic are extracted from Telegram metadata at the gateway level — works with any model\n\n## Limitations\n\n- Currently supports Telegram session key format (`agent:main:telegram:group:<id>:topic:<id>`)\n- Two-step process: `/load_previous` then another message to trigger injection\n- Messages are truncated at 2000 characters each\n\n## License\n\nMIT\n","readmeFilename":"README.md"}