diff --git oak-run/pom.xml oak-run/pom.xml
index 08871ef..657028e 100644
--- oak-run/pom.xml
+++ oak-run/pom.xml
@@ -33,11 +33,53 @@
   <properties>
     <skip.deployment>true</skip.deployment>
     <jetty.version>8.1.2.v20120308</jetty.version>
+    <groovy.version>2.3.1</groovy.version>
   </properties>
 
   <build>
+    <resources>
+      <resource>
+        <directory>src/main/groovy</directory>
+        <includes>
+          <include>**/*.properties</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+        <includes>
+          <include>**/*.*</include>
+        </includes>
+      </resource>
+    </resources>
     <plugins>
       <plugin>
+        <groupId>org.codehaus.gmaven</groupId>
+        <artifactId>gmaven-plugin</artifactId>
+        <version>1.4</version>
+        <!--suppress MavenModelInspection -->
+        <configuration>
+          <providerSelection>2.0</providerSelection>
+          <sourceEncoding>UTF-8</sourceEncoding>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generateStubs</goal>
+              <goal>compile</goal>
+              <goal>generateTestStubs</goal>
+              <goal>testCompile</goal>
+            </goals>
+          </execution>
+        </executions>
+        <dependencies>
+          <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-all</artifactId>
+            <version>${groovy.version}</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
         <version>1.6</version>
@@ -205,6 +247,16 @@
       <groupId>org.apache.jclouds.provider</groupId>
       <artifactId>aws-s3</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.groovy</groupId>
+      <artifactId>groovy-all</artifactId>
+      <version>${groovy.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>jline</groupId>
+      <artifactId>jline</artifactId>
+      <version>2.11</version>
+    </dependency>
     
     <!-- Findbugs annotations -->
     <dependency>
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/GroovyConsole.groovy oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/GroovyConsole.groovy
new file mode 100644
index 0000000..13ceab3
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/GroovyConsole.groovy
@@ -0,0 +1,294 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.jackrabbit.oak.console
+
+import groovy.transform.CompileStatic
+import groovy.transform.TypeCheckingMode
+import jline.Terminal
+import jline.TerminalFactory
+import jline.console.history.FileHistory
+import org.apache.jackrabbit.oak.console.commands.CdCommand
+import org.apache.jackrabbit.oak.console.commands.CheckpointCommand
+import org.apache.jackrabbit.oak.console.commands.LsCommand
+import org.apache.jackrabbit.oak.console.commands.LsdDocumentCommand
+import org.apache.jackrabbit.oak.console.commands.OakHelpCommand
+import org.apache.jackrabbit.oak.console.commands.PnCommand
+import org.apache.jackrabbit.oak.console.commands.PrintDocumentCommand
+import org.apache.jackrabbit.oak.console.commands.RefreshCommand
+import org.apache.jackrabbit.oak.console.commands.RetrieveCommand
+import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore
+import org.apache.jackrabbit.oak.run.Main
+import org.codehaus.groovy.runtime.StackTraceUtils
+import org.codehaus.groovy.tools.shell.ExitNotification
+import org.codehaus.groovy.tools.shell.Groovysh
+import org.codehaus.groovy.tools.shell.IO
+import org.codehaus.groovy.tools.shell.InteractiveShellRunner
+import org.codehaus.groovy.tools.shell.Interpreter
+import org.codehaus.groovy.tools.shell.commands.AliasCommand
+import org.codehaus.groovy.tools.shell.commands.ClearCommand
+import org.codehaus.groovy.tools.shell.commands.DisplayCommand
+import org.codehaus.groovy.tools.shell.commands.DocCommand
+import org.codehaus.groovy.tools.shell.commands.EditCommand
+import org.codehaus.groovy.tools.shell.commands.ExitCommand
+import org.codehaus.groovy.tools.shell.commands.HistoryCommand
+import org.codehaus.groovy.tools.shell.commands.ImportCommand
+import org.codehaus.groovy.tools.shell.commands.InspectCommand
+import org.codehaus.groovy.tools.shell.commands.LoadCommand
+import org.codehaus.groovy.tools.shell.commands.PurgeCommand
+import org.codehaus.groovy.tools.shell.commands.RecordCommand
+import org.codehaus.groovy.tools.shell.commands.RegisterCommand
+import org.codehaus.groovy.tools.shell.commands.SaveCommand
+import org.codehaus.groovy.tools.shell.commands.SetCommand
+import org.codehaus.groovy.tools.shell.commands.ShowCommand
+import org.codehaus.groovy.tools.shell.util.Preferences
+
+import org.codehaus.groovy.tools.shell.Command as ShellCommand
+
+@CompileStatic
+class GroovyConsole {
+    private final List<String> args
+    private final ConsoleSession session
+    private final Groovysh shell
+    private final boolean quiet;
+    private final IO io = new IO();
+
+    GroovyConsole(ConsoleSession session, List<String> args, boolean quiet) {
+        this.args = args;
+        this.session = session
+        this.shell = prepareShell()
+        this.quiet = quiet
+    }
+
+    int run(){
+        return shell.run(args as String[])
+    }
+
+    int execute(List<String> args){
+        try {
+            shell.execute(args.join(' '))
+            return 0;
+        }catch(Throwable t){
+            t.printStackTrace(new PrintStream(System.out));
+            return 1;
+        }
+    }
+
+    private Groovysh prepareShell() {
+        Binding binding = new Binding(args as String[])
+        binding['session'] = session
+        if(quiet) {
+            io.verbosity = IO.Verbosity.QUIET
+        }
+        Groovysh sh = new OakSh(getClass().getClassLoader(),
+                binding, io, this.&registerCommands)
+        sh.imports << 'org.apache.jackrabbit.oak.plugins.document.*'
+        return sh
+    }
+
+    private void registerCommands(Groovysh shell){
+        List<? extends ShellCommand> commands = []
+        commands.addAll([
+                new ExitCommand(shell),
+                new ImportCommand(shell),
+                new DisplayCommand(shell),
+                new ClearCommand(shell),
+                new ShowCommand(shell),
+                new InspectCommand(shell),
+                new PurgeCommand(shell),
+                new EditCommand(shell),
+                new LoadCommand(shell),
+                new SaveCommand(shell),
+                new RecordCommand(shell),
+                new HistoryCommand(shell),
+                new AliasCommand(shell),
+                new SetCommand(shell),
+                // does not do anything
+                //new ShadowCommand(shell),
+                new RegisterCommand(shell),
+                new DocCommand(shell),
+        ]);
+
+        commands.addAll([
+                //Oak Commands
+                new OakHelpCommand(shell),
+                new CdCommand(shell),
+                new CheckpointCommand(shell),
+                new LsCommand(shell),
+                new PnCommand(shell),
+                new RefreshCommand(shell),
+                new RetrieveCommand(shell)
+        ])
+
+        if(session.store instanceof DocumentNodeStore){
+            commands.addAll([
+                    //Oak Commands
+                    new PrintDocumentCommand(shell),
+                    new LsdDocumentCommand(shell),
+            ])
+        }
+
+        commands.each {ShellCommand command ->
+            shell.register(command)
+        }
+    }
+
+    private class OakSh extends Groovysh {
+        private boolean colored = false
+
+        OakSh(ClassLoader classLoader, Binding binding, IO io, Closure registrar) {
+            super(classLoader, binding, io, registrar)
+        }
+
+        public String renderPrompt() {
+            return prompt.render( buildPrompt() )
+        }
+
+        //Following methods are copied because they are private in parent however
+        //they are referred via method handle which somehow looks for method in
+        //derived class
+        private String buildPrompt() {
+            def prefix = session.workingPath
+            def groovyshellProperty = System.getProperty("groovysh.prompt")
+            def groovyshellEnv = System.getenv("GROOVYSH_PROMPT")
+            if (groovyshellProperty) {
+                prefix = groovyshellProperty
+            } else if (groovyshellEnv) {
+                prefix = groovyshellEnv
+            }
+            return colored ? "@|bold,blue ${prefix}>|@ " : "${prefix}>"
+        }
+
+        private void displayError(final Throwable cause) {
+            if (errorHook == null) {
+                throw new IllegalStateException("Error hook is not set")
+            }
+            if (cause instanceof MissingPropertyException) {
+                if (cause.type && cause.type.canonicalName == Interpreter.SCRIPT_FILENAME) {
+                    io.err.println("@|bold,red Unknown property|@: " + cause.property)
+                    return
+                }
+            }
+
+            errorHook.call(cause)
+        }
+
+        @CompileStatic(TypeCheckingMode.SKIP)
+        private void maybeRecordError(Throwable cause) {
+            def record = registry[RecordCommand.COMMAND_NAME]
+
+            if (record != null) {
+                boolean sanitize = Preferences.sanitizeStackTrace
+
+                if (sanitize) {
+                    cause = StackTraceUtils.deepSanitize(cause);
+                }
+
+                record.recordError(cause)
+            }
+        }
+
+        @CompileStatic(TypeCheckingMode.SKIP)
+        int run(final String commandLine) {
+            Terminal term = TerminalFactory.create()
+            colored = term.ansiSupported
+            if (log.debug) {
+                log.debug("Terminal ($term)")
+                log.debug("    Supported:  $term.supported")
+                log.debug("    ECHO:       (enabled: $term.echoEnabled)")
+                log.debug("    H x W:      ${term.getHeight()} x ${term.getWidth()}")
+                log.debug("    ANSI:       ${term.isAnsiSupported()}")
+
+                if (term instanceof jline.WindowsTerminal) {
+                    jline.WindowsTerminal winterm = (jline.WindowsTerminal) term
+                    log.debug("    Direct:     ${winterm.directConsole}")
+                }
+            }
+
+            def code
+
+            try {
+                loadUserScript('groovysh.profile')
+
+                // if args were passed in, just execute as a command
+                // (but cygwin gives an empty string, so ignore that)
+                if (commandLine != null && commandLine.trim().size() > 0) {
+                    // Run the given commands
+                    execute(commandLine)
+                } else {
+                    loadUserScript('groovysh.rc')
+
+                    // Setup the interactive runner
+                    runner = new InteractiveShellRunner(
+                            this,
+                            this.&renderPrompt as Closure,
+                            Integer.valueOf(Preferences.get(METACLASS_COMPLETION_PREFIX_LENGTH_PREFERENCE_KEY, '3')))
+
+                    // Setup the history
+                    File histFile = new File(userStateDirectory, 'groovysh.history')
+                    history = new FileHistory(histFile)
+                    runner.setHistory(history)
+
+                    // Setup the error handler
+                    runner.errorHandler = this.&displayError
+
+                    //
+                    // TODO: See if we want to add any more language specific completions, like for println for example?
+                    //
+
+                    // Display the welcome banner
+                    if (!io.quiet) {
+                        int width = term.getWidth()
+
+                        // If we can't tell, or have something bogus then use a reasonable default
+                        if (width < 1) {
+                            width = 80
+                        }
+
+                        io.out.println("@|green Jackrabbit Oak Shell|@ (${Main.getProductInfo()}, " +
+                                "JVM: ${System.properties['java.version']})")
+                        io.out.println("Type '@|bold :help|@' or '@|bold :h|@' for help.")
+                        io.out.println('-' * (width - 1))
+                    }
+
+                    // And let 'er rip... :-)
+                    runner.run()
+                }
+
+                code = 0
+            }
+            catch (ExitNotification n) {
+                log.debug("Exiting w/code: ${n.code}")
+
+                code = n.code
+            }
+            catch (Throwable t) {
+                io.err.println(messages.format('info.fatal', t))
+                t.printStackTrace(io.err)
+
+                code = 1
+            }
+
+            assert code != null // This should never happen
+
+            return code
+        }
+
+    }
+}
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CdCommand.groovy oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CdCommand.groovy
new file mode 100644
index 0000000..6e33133
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CdCommand.groovy
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+
+package org.apache.jackrabbit.oak.console.commands
+
+import com.google.common.collect.Lists
+import groovy.transform.CompileStatic
+import jline.console.completer.Completer
+import org.apache.jackrabbit.oak.commons.PathUtils
+import org.apache.jackrabbit.oak.console.ConsoleSession
+import org.codehaus.groovy.tools.shell.CommandSupport
+import org.codehaus.groovy.tools.shell.Groovysh
+import org.codehaus.groovy.tools.shell.util.SimpleCompletor
+
+
+@CompileStatic
+class CdCommand extends CommandSupport{
+    public static final String COMMAND_NAME = 'change-dir'
+
+    public CdCommand(Groovysh shell) {
+        super(shell, COMMAND_NAME, 'cd')
+    }
+
+    @Override
+    protected List<Completer> createCompleters() {
+        return [
+                new SimpleCompletor(){
+                    @Override
+                    SortedSet getCandidates() {
+                        SortedSet<String> names = new TreeSet<String>()
+                        getSession().getWorkingNode().childNodeNames.each {
+                            names << it
+                        }
+                        return names
+                    }
+                },
+                null
+        ]
+    }
+
+    @Override
+    Object execute(List<String> args) {
+        if(args.isEmpty()){
+            return;
+        }
+
+        String arg = args[0]?.trim()
+        if (!PathUtils.isValid(arg)) {
+            io.out.println("Not a valid path: " + args);
+            return;
+        }
+        String path;
+        if (PathUtils.isAbsolute(arg)) {
+            path = args;
+        } else {
+            path = PathUtils.concat(session.getWorkingPath(), arg);
+        }
+        List<String> elements = Lists.newArrayList();
+        PathUtils.elements(path).each{String element ->
+            if (PathUtils.denotesParent(element)) {
+                if (!elements.isEmpty()) {
+                    elements.remove(elements.size() - 1);
+                }
+            } else if (!PathUtils.denotesCurrent(element)) {
+                elements.add(element);
+            }
+        }
+        path = PathUtils.concat("/", elements.toArray(new String[elements.size()]));
+        String old = session.setWorkingPath(path);
+        if (!session.getWorkingNode().exists()) {
+            session.setWorkingPath(old);
+            io.out.println("No such node");
+        }
+    }
+
+    ConsoleSession getSession(){
+        return (ConsoleSession)variables.session
+    }
+}
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CdCommand.properties oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CdCommand.properties
new file mode 100644
index 0000000..e876dd4
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CdCommand.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# $Id$
+#
+
+command.description=Change the current working directory to a specific node.
+command.usage=
+command.help=Change the current working directory to a specific node.
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CheckpointCommand.groovy oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CheckpointCommand.groovy
new file mode 100644
index 0000000..709f187
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CheckpointCommand.groovy
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.console.commands
+
+import groovy.transform.CompileStatic
+import org.apache.jackrabbit.oak.console.ConsoleSession
+import org.codehaus.groovy.tools.shell.CommandSupport
+import org.codehaus.groovy.tools.shell.Groovysh
+
+import java.util.concurrent.TimeUnit
+
+
+@CompileStatic
+class CheckpointCommand extends CommandSupport{
+    public static final String COMMAND_NAME = 'checkpoint'
+
+    public CheckpointCommand(Groovysh shell) {
+        super(shell, COMMAND_NAME, 'cp')
+    }
+
+    @Override
+    Object execute(List<String> args) {
+        long time = TimeUnit.HOURS.toSeconds(1);
+        if (args) {
+            time = args[0] as long
+        }
+
+        Calendar cal = Calendar.getInstance();
+        cal.add(Calendar.SECOND, (int) time);
+        io.out.println "Checkpoint created: ${session.checkpoint(time)} (expires: ${cal.getTime().toString()})."
+    }
+
+    ConsoleSession getSession(){
+        return (ConsoleSession)variables.session
+    }
+}
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CheckpointCommand.properties oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CheckpointCommand.properties
new file mode 100644
index 0000000..0d0d95d
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/CheckpointCommand.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# $Id$
+#
+
+command.description=Create a checkpoint.
+command.usage=
+command.help=Create a checkpoint.
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsCommand.groovy oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsCommand.groovy
new file mode 100644
index 0000000..62d6eab
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsCommand.groovy
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.jackrabbit.oak.console.commands
+
+import groovy.transform.CompileStatic
+import org.apache.jackrabbit.oak.console.ConsoleSession
+import org.codehaus.groovy.tools.shell.CommandSupport
+import org.codehaus.groovy.tools.shell.Groovysh
+
+
+@CompileStatic
+class LsCommand extends CommandSupport{
+    public static final String COMMAND_NAME = 'list'
+
+    public LsCommand(Groovysh shell) {
+        super(shell, COMMAND_NAME, 'ls')
+    }
+
+    @Override
+    Object execute(List<String> args) {
+        assertNoArguments(args)
+        getSession().getWorkingNode().childNodeNames.each {
+            io.out.println(it)
+        }
+        return null
+    }
+
+    ConsoleSession getSession(){
+        return (ConsoleSession)variables.session
+    }
+}
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsCommand.properties oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsCommand.properties
new file mode 100644
index 0000000..ba677e7
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsCommand.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# $Id$
+#
+
+command.description=List the names of the children of the current node.
+command.usage=
+command.help=List the names of the children of the current node.
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.groovy oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.groovy
new file mode 100644
index 0000000..c3464a9
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.groovy
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.jackrabbit.oak.console.commands
+
+import groovy.transform.CompileStatic
+import org.apache.jackrabbit.oak.console.ConsoleSession
+import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore
+import org.apache.jackrabbit.oak.plugins.document.NodeDocument
+import org.apache.jackrabbit.oak.plugins.document.util.Utils
+import org.codehaus.groovy.tools.shell.CommandSupport
+import org.codehaus.groovy.tools.shell.Groovysh
+
+import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES
+
+@CompileStatic
+class LsdDocumentCommand extends CommandSupport{
+    public static final String COMMAND_NAME = 'list-identifiers'
+
+    public LsdDocumentCommand(Groovysh shell) {
+        super(shell, COMMAND_NAME, 'lsd')
+    }
+
+    @Override
+    Object execute(List<String> args) {
+        assert session.store instanceof DocumentNodeStore
+        PrintWriter writer = io.out
+        String path = session.getWorkingPath();
+        String fromKey = Utils.getKeyLowerLimit(path);
+        String toKey = Utils.getKeyUpperLimit(path);
+        int num = 0;
+        for (NodeDocument doc : store.getDocumentStore().query(
+                NODES, fromKey, toKey, Integer.MAX_VALUE)) {
+            writer.write(doc.getId());
+            println(writer);
+            num++;
+        }
+        println(writer);
+        writer.write("Found " + num + " document");
+        if (num != 1) {
+            writer.write("s");
+        }
+        writer.write(".");
+        println(writer);
+        writer.flush();
+    }
+
+    ConsoleSession getSession(){
+        return (ConsoleSession)variables.session
+    }
+
+    DocumentNodeStore getStore(){
+        return (DocumentNodeStore)session.getStore();
+    }
+}
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.properties oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.properties
new file mode 100644
index 0000000..9defd8a
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/LsdDocumentCommand.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# $Id$
+#
+
+command.description=List the identifiers of the child documents at the current path.
+command.usage=
+command.help=List the identifiers of the child documents at the current path.
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/OakHelpCommand.groovy oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/OakHelpCommand.groovy
new file mode 100644
index 0000000..0372718
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/OakHelpCommand.groovy
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.jackrabbit.oak.console.commands
+
+import org.codehaus.groovy.tools.shell.Command
+import org.codehaus.groovy.tools.shell.CommandSupport
+import org.codehaus.groovy.tools.shell.Groovysh
+import org.codehaus.groovy.tools.shell.completion.CommandNameCompleter
+
+/**
+ * Copy of org.codehaus.groovy.tools.shell.commands.HelpCommand to customize
+ * the banner
+ */
+class OakHelpCommand extends CommandSupport{
+    public static final String COMMAND_NAME = ':help'
+
+    OakHelpCommand(final Groovysh shell) {
+        super(shell, COMMAND_NAME, ':h')
+
+        alias('?', ':?')
+    }
+
+    protected List createCompleters() {
+        return [
+                new CommandNameCompleter(registry),
+                null
+        ]
+    }
+
+    Object execute(final List<String> args) {
+        assert args != null
+
+        if (args.size() > 1) {
+            fail(messages.format('error.unexpected_args', args.join(' ')))
+        }
+
+        if (args.size() == 1) {
+            help(args[0])
+        }
+        else {
+            list()
+        }
+    }
+
+    private void help(final String name) {
+        assert name
+
+        Command command = registry.find(name)
+        if (!command) {
+            fail("No such command: $name") // TODO: i18n
+        }
+
+        io.out.println()
+        io.out.println("usage: @|bold ${command.name}|@ $command.usage") // TODO: i18n
+        io.out.println()
+        io.out.println(command.help)
+        io.out.println()
+    }
+
+    private void list() {
+        // Figure out the max command name and shortcut length dynamically
+        int maxName = 0
+        int maxShortcut
+
+        for (Command command in registry.commands()) {
+            if (command.hidden) {
+                continue
+            }
+
+            if (command.name.size() > maxName) {
+                maxName = command.name.size()
+            }
+
+            if (command.shortcut.size() > maxShortcut) {
+                maxShortcut = command.shortcut.size()
+            }
+        }
+
+        io.out.println()
+        io.out.println('For information about @|green Apache Jackrabbit Oak|@, visit:') // TODO: i18n
+        io.out.println('    @|cyan http://jackrabbit.apache.org/oak/|@ ')
+        io.out.println()
+
+        // List the commands we know about
+        io.out.println('Available commands:') // TODO: i18n
+
+        for (Command command in registry.commands()) {
+            if (command.hidden) {
+                continue
+            }
+
+            def n = command.name.padRight(maxName, ' ')
+            def s = command.shortcut.padRight(maxShortcut, ' ')
+
+            //
+            // TODO: Wrap description if needed
+            //
+
+            def d = command.description
+
+            io.out.println("  @|bold ${n}|@  (@|bold ${s}|@) $d")
+        }
+
+        io.out.println()
+        io.out.println('For help on a specific command type:') // TODO: i18n
+        io.out.println('    :help @|bold command|@ ')
+        io.out.println()
+    }
+}
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/OakHelpCommand.properties oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/OakHelpCommand.properties
new file mode 100644
index 0000000..ecc767a
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/OakHelpCommand.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# $Id$
+#
+
+command.description=Display this help message
+command.usage=[<command>]
+command.help=Display the list of commands or the help text for @|BOLD command|@.
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PnCommand.groovy oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PnCommand.groovy
new file mode 100644
index 0000000..36de93f
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PnCommand.groovy
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+
+package org.apache.jackrabbit.oak.console.commands
+
+import groovy.transform.CompileStatic
+import org.apache.jackrabbit.oak.console.ConsoleSession
+import org.apache.jackrabbit.oak.spi.state.AbstractNodeState
+import org.codehaus.groovy.tools.shell.CommandSupport
+import org.codehaus.groovy.tools.shell.Groovysh
+
+
+@CompileStatic
+class PnCommand extends CommandSupport{
+    public static final String COMMAND_NAME = 'print-node'
+
+    public PnCommand(Groovysh shell) {
+        super(shell, COMMAND_NAME, 'pn')
+    }
+
+    @Override
+    Object execute(List<String> args) {
+        assertNoArguments(args)
+        io.out.println(AbstractNodeState.toString(getSession().getWorkingNode()))
+    }
+
+    ConsoleSession getSession(){
+        return (ConsoleSession)variables.session
+    }
+}
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PnCommand.properties oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PnCommand.properties
new file mode 100644
index 0000000..a193f31
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PnCommand.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# $Id$
+#
+
+command.description=Print the current node.
+command.usage=
+command.help=Print the current node.
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PrintDocumentCommand.groovy oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PrintDocumentCommand.groovy
new file mode 100644
index 0000000..ad81dce
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PrintDocumentCommand.groovy
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+
+package org.apache.jackrabbit.oak.console.commands
+
+import com.google.common.collect.Sets
+import groovy.transform.CompileStatic
+import org.apache.jackrabbit.oak.console.ConsoleSession
+import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore
+import org.apache.jackrabbit.oak.plugins.document.NodeDocument
+import org.apache.jackrabbit.oak.plugins.document.util.Utils
+import org.codehaus.groovy.tools.shell.CommandSupport
+import org.codehaus.groovy.tools.shell.Groovysh
+import org.json.simple.JSONObject
+import org.json.simple.JSONValue
+
+import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES
+
+
+@CompileStatic
+class PrintDocumentCommand extends CommandSupport{
+    public static final String COMMAND_NAME = 'print-document'
+
+    public PrintDocumentCommand(Groovysh shell) {
+        super(shell, COMMAND_NAME, 'pd')
+    }
+
+    @Override
+    Object execute(List<String> args) {
+        assert session.store instanceof DocumentNodeStore
+        String id = Utils.getIdFromPath(session.getWorkingPath());
+        NodeDocument doc = store.getDocumentStore().find(NODES, id);
+        if (doc == null) {
+            io.out.println("[null]");
+        } else {
+            println(doc, io.out);
+        }
+    }
+
+    ConsoleSession getSession(){
+        return (ConsoleSession)variables.session
+    }
+
+    DocumentNodeStore getStore(){
+        return (DocumentNodeStore)session.getStore();
+    }
+
+    private void println(NodeDocument doc, PrintWriter writer)
+            throws IOException {
+        int level = 1;
+        Set<String> mapKeys = Sets.newHashSet();
+        writer.write('{');
+        String comma = "";
+        for (String key : doc.keySet()) {
+            Object value = doc.get(key);
+            if (value instanceof Map) {
+                mapKeys.add(key);
+                continue;
+            }
+            writer.write(comma);
+            comma = ",";
+            writer.println();
+            printIndent(level, writer);
+            printJson(key, value, writer);
+        }
+        for (String key : mapKeys) {
+            writer.write(comma);
+            comma = ",";
+            writer.println();
+            printIndent(level, writer);
+            writer.write(JSONObject.escape(key));
+            writer.write(": {");
+            println((Map) doc.get(key), level + 1, writer);
+            writer.println();
+            printIndent(level, writer);
+            writer.write("}");
+        }
+        writer.println();
+        writer.write('}');
+        writer.println();
+        writer.flush();
+    }
+
+    private void println(Map map, int level, Writer writer)
+            throws IOException {
+        String comma = "";
+        for (Object obj : map.keySet()) {
+            String key = obj.toString();
+            Object value = map.get(obj);
+            writer.write(comma);
+            comma = ",";
+            writer.println();
+            printIndent(level, writer);
+            printJson(key, value, writer);
+        }
+    }
+
+    private static void printJson(String key, Object value, Writer writer)
+            throws IOException {
+        writer.write(JSONObject.escape(key));
+        writer.write(": ");
+        writer.write(jsonEscape(value));
+    }
+
+    private static String jsonEscape(Object value) {
+        String escaped = JSONValue.toJSONString(value);
+        return escaped.replaceAll("\\\\/", "/");
+    }
+
+    private static void printIndent(int level, Writer writer) throws IOException {
+        writer.write(' '* (level *4))
+    }
+}
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PrintDocumentCommand.properties oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PrintDocumentCommand.properties
new file mode 100644
index 0000000..1d3022d
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/PrintDocumentCommand.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# $Id$
+#
+
+command.description=Print the current document.
+command.usage=
+command.help=Print the current document.
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RefreshCommand.groovy oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RefreshCommand.groovy
new file mode 100644
index 0000000..18e0d60
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RefreshCommand.groovy
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+
+package org.apache.jackrabbit.oak.console.commands
+
+import groovy.transform.CompileStatic
+import org.apache.jackrabbit.oak.console.ConsoleSession
+import org.codehaus.groovy.tools.shell.CommandSupport
+import org.codehaus.groovy.tools.shell.ComplexCommandSupport
+import org.codehaus.groovy.tools.shell.Groovysh
+
+
+@CompileStatic
+class RefreshCommand extends ComplexCommandSupport{
+    public static final String COMMAND_NAME = 'refresh'
+
+    public RefreshCommand(Groovysh shell) {
+        super(shell, COMMAND_NAME, 'rf', ['auto', 'manual', 'now'], 'now')
+    }
+
+    def do_auto = {
+        getSession().autoRefresh = true
+        io.out.println("Enabled auto refresh")
+    }
+
+    def do_manual = {
+        getSession().autoRefresh = false
+        io.out.println("Disabled auto refresh")
+    }
+
+    def do_refresh = {
+        getSession().refresh()
+        io.out.println("Session refreshed")
+    }
+
+    ConsoleSession getSession(){
+        return (ConsoleSession)variables.session
+    }
+}
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RefreshCommand.properties oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RefreshCommand.properties
new file mode 100644
index 0000000..bc42e9c
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RefreshCommand.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# $Id$
+#
+
+command.description=Control how the current session is refreshed.
+command.usage=[<auot>|<manual>|<now>]
+command.help=Control how the current session is refreshed.
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RetrieveCommand.groovy oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RetrieveCommand.groovy
new file mode 100644
index 0000000..a734b82
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RetrieveCommand.groovy
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.console.commands
+
+import groovy.transform.CompileStatic
+import org.apache.jackrabbit.oak.console.ConsoleSession
+import org.codehaus.groovy.tools.shell.CommandSupport
+import org.codehaus.groovy.tools.shell.Groovysh
+
+@CompileStatic
+class RetrieveCommand extends CommandSupport{
+    public static final String COMMAND_NAME = 'retrieve'
+
+    public RetrieveCommand(Groovysh shell) {
+        super(shell, COMMAND_NAME, 'rt')
+    }
+
+    @Override
+    Object execute(List<String> args) {
+        if (session.isAutoRefresh()) {
+            session.setAutoRefresh(false);
+            io.out.println("Auto refresh disabled.");
+        }
+        session.retrieve(args[0].trim());
+    }
+
+    ConsoleSession getSession(){
+        return (ConsoleSession)variables.session
+    }
+}
diff --git oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RetrieveCommand.properties oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RetrieveCommand.properties
new file mode 100644
index 0000000..2be8787
--- /dev/null
+++ oak-run/src/main/groovy/org/apache/jackrabbit/oak/console/commands/RetrieveCommand.properties
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# $Id$
+#
+
+command.description=Retrieve a snapshot of the given checkpoint
+command.usage=
+command.help=Retrieve a snapshot of the given checkpoint
diff --git oak-run/src/main/java/org/apache/jackrabbit/oak/console/Console.java oak-run/src/main/java/org/apache/jackrabbit/oak/console/Console.java
index 47ae113..8462a08 100644
--- oak-run/src/main/java/org/apache/jackrabbit/oak/console/Console.java
+++ oak-run/src/main/java/org/apache/jackrabbit/oak/console/Console.java
@@ -63,6 +63,8 @@ public class Console {
                 .withRequiredArg().ofType(Integer.class).defaultsTo(1);
         OptionSpec<String> eval = parser.accepts("eval", "Evaluate script")
                 .withRequiredArg().ofType(String.class);
+        OptionSpec quiet = parser.accepts("quiet", "be less chatty");
+        OptionSpec shell = parser.accepts("shell", "run the shell after executing files");
         OptionSpec help = parser.acceptsAll(asList("h", "?", "help"), "show help").forHelp();
         OptionSpec<String> nonOption = parser.nonOptions("console {<path-to-repository> | <mongodb-uri>}");
 
@@ -94,8 +96,26 @@ public class Console {
             store = new SegmentNodeStore(new FileStore(
                     new File(nonOptions.get(0)), 256));
         }
+        
+        
 
-        Console console = new Console(store, System.in, System.out);
+        List<String> scriptArgs = nonOptions.size() > 1 ?
+                nonOptions.subList(1, nonOptions.size()) : Collections.<String>emptyList();
+        GroovyConsole console =
+                new GroovyConsole(ConsoleSession.create(store), scriptArgs, options.has(quiet));
+
+        int code = 0;
+        if(!scriptArgs.isEmpty()){
+            code = console.execute(scriptArgs);
+        }
+
+        if(scriptArgs.isEmpty() || options.has(shell)){
+            code = console.run();
+        }
+
+        System.exit(code);
+
+        /*Console console = new Console(store, System.in, System.out);
         String script = eval.value(options);
         if (script != null) {
             Command evalCommand = new Command.Eval();
@@ -103,7 +123,7 @@ public class Console {
             System.exit(console.run(evalCommand));
         }
 
-        System.exit(console.run());
+        System.exit(console.run());*/
     }
 
     private final InputStream in;
diff --git oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
index dcf8fb8..e3490d4 100644
--- oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
+++ oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
@@ -123,7 +123,7 @@ public class Main {
         }
     }
 
-    private static void printProductInfo() {
+    public static String getProductInfo(){
         String version = null;
 
         try {
@@ -148,7 +148,11 @@ public class Main {
             product = "Apache Jackrabbit Oak";
         }
 
-        System.out.println(product);
+        return product;
+    }
+
+    private static void printProductInfo() {
+        System.out.println(getProductInfo());
     }
 
     private static void backup(String[] args) throws IOException {
