Commit 8e3ea0d
feat: Unify session management across MCP codebase (#538)
* feat: Phase 1 - Add data storage capabilities to unified session system
Enhance utils/session/ with workflow data storage:
- Add `data` field to Session model for key-value storage
- Add get(), set(), delete(), clear_data() methods to Session
- Update FileSystemSessionStorage to persist data field to data.json
- Update MemorySessionStorage to handle data field
- Add comprehensive tests for data storage functionality
- Update serialization (to_dict/from_dict) to include data field
This is Phase 1 of the session unification plan, enabling the session
system to support both conversation tracking and workflow data storage.
All 60 session tests pass including 6 new data storage tests.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* feat: Phase 2 - Migrate utils/agent/ to use SessionManager
Replace in-memory agent sessions with unified SessionManager:
- Add SessionManager integration to SpecializedAgent
- Create _create_storage() method for storage backend selection
- Use FileSystemSessionStorage when session_storage_path is set
- Use MemorySessionStorage otherwise (backward compatible)
- Update _get_session_history() to convert ConversationMessage to dict
- Update _add_to_history() to use add_conversation_message()
- Update clear_session_history() to use SessionManager API
- Update get_session_history() to return same format as before
- Update set_session() to ensure session exists
- Fix test for _sessions attribute (now _session_manager)
- Fix test with invalid filesystem path to use temp directory
All 98 agent tests pass + 24 ExploreAgent tests pass.
Agents now support both memory and filesystem persistence!
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* feat: Phase 3 - Delete old automation session module
Remove plugins/automation/runtime_data/session.py:
- Delete SessionData, SessionStorage, get_storage() module
- Update runtime_data/__init__.py to remove session exports
- Add note directing users to utils.session.SessionManager
- No breaking changes: module was not yet in use
All 89 passing automation tests still pass.
4 pre-existing workflow engine test failures unchanged.
This completes the session unification migration. The codebase now
has a single unified session system in utils/session/ supporting:
- Conversation tracking (for agents and tools)
- Key-value data storage (for workflows)
- Metadata and statistics
- Multiple storage backends (memory, filesystem)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* docs: Update session unification plan with completion summary
Mark plan as completed and add implementation summary:
- All 3 phases completed successfully in ~1 hour
- 247 tests passing (60 session + 98 agent + 89 automation)
- ~160 lines of duplicate code deleted
- Zero breaking changes
- New capabilities: persistent agent sessions, unified data storage
Phase 1 (30 min): Enhanced utils/session/ with data storage
Phase 2 (20 min): Migrated utils/agent/ to SessionManager
Phase 3 (10 min): Deleted automation session module
Key achievements:
✅ Single unified session system across entire codebase
✅ Agents support both memory and filesystem persistence
✅ Sessions support conversation tracking + data storage
✅ No backward compatibility issues
Much faster than estimated 1.5-2 weeks due to:
- Experimental automation plugin allowed direct deletion
- Well-tested foundation (54 existing session tests)
- Clean internal separation in agent implementation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent ef891e0 commit 8e3ea0d
File tree
10 files changed
+1559
-190
lines changed- docs
- plugins/automation/runtime_data
- utils
- agent
- tests
- session
- tests
10 files changed
+1559
-190
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 19 | | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
91 | 115 | | |
92 | 116 | | |
93 | 117 | | |
| |||
176 | 200 | | |
177 | 201 | | |
178 | 202 | | |
179 | | - | |
180 | | - | |
181 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
182 | 211 | | |
183 | 212 | | |
184 | 213 | | |
185 | | - | |
186 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
187 | 220 | | |
188 | 221 | | |
189 | 222 | | |
| |||
307 | 340 | | |
308 | 341 | | |
309 | 342 | | |
310 | | - | |
311 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
312 | 347 | | |
313 | 348 | | |
314 | 349 | | |
| |||
322 | 357 | | |
323 | 358 | | |
324 | 359 | | |
325 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
326 | 368 | | |
327 | 369 | | |
328 | 370 | | |
| |||
332 | 374 | | |
333 | 375 | | |
334 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
335 | 383 | | |
336 | 384 | | |
337 | 385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
| |||
Lines changed: 18 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| |||
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
147 | 170 | | |
148 | 171 | | |
149 | 172 | | |
150 | 173 | | |
151 | 174 | | |
152 | 175 | | |
| 176 | + | |
153 | 177 | | |
154 | 178 | | |
155 | 179 | | |
| |||
161 | 185 | | |
162 | 186 | | |
163 | 187 | | |
| 188 | + | |
164 | 189 | | |
0 commit comments